webmozarts / glob Goto Github PK
View Code? Open in Web Editor NEWA PHP implementation of Ant's glob.
License: MIT License
A PHP implementation of Ant's glob.
License: MIT License
Glob::match(
"file:///C:/Users/felix/git/OpenSource/php-language-server/fixtures/format.php",
"C:/Users/felix/git/OpenSource/php-language-server/fixtures/**/*.php"
);
Expected: true
(the glob should only be applied on the "path" component of the URI, not the scheme)
Actual: false
(since no scheme is defined in the glob pattern)
The method Glob::combine($glob1, $glob2)
should be added that combines two globs/paths into another, stricter glob/path. The method should behave like this:
null
otherwise.null
otherwise.null
otherwise.Example for a combined glob:
Glob::combine('/foo/bar/**/*.yml', '/**/messages.yml') => '/foo/bar/**/messages.yml'
This is needed for implementing GlobBinding::findResources()
in puli/issues#114.
Hi @webmozart - thank you for providing the glob library.
Are you still maintaining the project? We would like have new version available on packist.org which runs with current PHP versions.
I mean, it impacts a lot while the fix is fast.
I have a backuptool that uses a directory structure to store files, e.g.:
/my/path/to/backupfiles/year/month/day/filename.ext
I'd like to unittest my code, so I'm looking into e.g. vfsStream to emulate the expected (and unexpected) structure.
I generate a glob pattern somewhere that is used to find files relating to certain servers, backup types (sql/files/etc) etc.
php's glob() works fine in production but doesn't work well with vfsStream; webmozart\glob looks promising but doesn't work well with streamwrappers such as vfsStream.
I found Path::isAbsolute() to be the culprit; if I simply return true, the code works fine otherwise.
The current implementation could be extended to support the following expressions.
For reference see http://man7.org/linux/man-pages/man7/glob.7.html
I thought this library has a fallback wrapper like laminas/laminas-stdlib glob.
It looks like that GLOB_BRACE
is not supported in Alpine Linux (see https://bugs.php.net/bug.php?id=72095).
This leads to the following warning
Warning: glob() expects parameter 2 to be integer, string given in /app/vendor/webmozart/glob/src/Iterator/GlobIterator.php on line 55
In the link above there is also a proposed workaround to avoid such a problem
is it possible to use Regex in Resource Pattern matching?
Like:
$files = Glob::glob('/**/*\.[css|js|jpeg]');
I think would be great to remove symfony/filesystem dependence because it used only in tests and conflicts with symfony 3.4/4.4. Many developers who used symfony 3.4/4.4 can't require this great lib. This is no have any reasons to use symfony/filesystem in dev requirements. It should be replaced by native php or add a range symfony/filesystem: ^4.4|^5.0. Thanks
I'm trying to filter some paths, where I want to use **. Unfortunately, the regex that's getting computed internal to Glob::filter()
seems to be incorrect.
For example, the pattern /**
compiles to ~^/[^/]*[^/]*$~
. That will match /
, /foo
, /bar
, but not /foo/bar
. I believe it should be matching /foo/bar
.
Similarly, the pattern /foo/**
compiles to ~^/foo/[^/]*[^/]*$~
. That will match /foo
, /foo/bar
, but not /foo/bar/baz
.
So either there is a bug in the regex compiler in handling **, or I'm not understanding **
properly. I suppose either is possible. If there is some other way I should be doing this, please advise. (In practice I think I only need prefix-matching, but was trying to use a full glob for it for flexibility.)
Just porting the issue from maglnet/ComposerRequireChecker#315 and quoting @Ocramius:
FWIW, if there's a non-symfony solution to that, it could be a better approach: mostly worried about dwindling package quality and continuously increasing dependency ranges in symfony/*.
I dont know another non-symfony package that is doing the stuff needed. Only used path-util / glob or filesystem / finder, so suggestions welcome i guess ๐ฏ
I open this not for an issue, but to discuss the possibility of adding Glob to Symfony FileSystem or Symfony Finder. Will this be possible?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.