The Finder component gives you a nice DSL to let you find files and directories.
Filter by Path¶
name() method restricts files by name; it accepts strings, globs, or
As of Symfony 2.2, you can also restrict files and directories by path, via
path() method, which accepts strings or regexes:
To negate the restriction, use the
Learn more about this new feature in the documentation.
Glob Support for the in() method¶
in() method tells the Finder to look for files and directories into
the passed directories. As of 2.2, you can define these directories as globs:
Documentation is available in the Finder component chapter.
Speedup on some Platforms¶
Last but not least, and only for some platforms (like Linux, MacOs, and BSD), the Finder performance was greatly improved by converting the criteria to native commands. Have a look at the initial benchmark results that were published when the pull request was submitted.
We need your help for this change as sometimes, the optimized version does not work on some Unix versions; so we need to be sure to exclude those cases and fallback to the PHP adapter. Test on your environment and report if there are any issues.