e1c741db9c
* 2.2: (22 commits) fixed doc references (closes #7515) fixed doc references (closes #7515) On OS X, sys_get_tmp_dir() returns /var/private/..., which really is below /private/var. Doctrine cannot handle bare random non-utf8 strings small changes [SecurityBundle] Fixed configuration exemple idAsIndex should be true with a smallint or bigint id field. [PropertyAccess] Remove trailing periods from doc blocks Fix param docs for PropertyAccessor read method Fixed long multibyte parameter logging in DbalLogger:startQuery Keep the file extension in the temporary copy and test that it exists (closes #7482) bumped Symfony version to 2.1.10-DEV [Validator][translation][japanese]replaced period to japanese one [Validator][translation][japanese]fixed japanese translation to more practical one [Validator][translation][japanese]fixed message ordering to be consistent with other languages [Validator][translation][japanese]added new validation messages in japanese translation updated VERSION for 2.1.9 update CONTRIBUTORS for 2.1.9 updated CHANGELOG for 2.1.9 [Security] fixed wrong interface Remove already defined arguments Add missing use [FrameworkBundle] Reuse definition variable in FormPass ... Conflicts: src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig |
||
---|---|---|
.. | ||
Adapter | ||
Comparator | ||
Exception | ||
Expression | ||
Iterator | ||
Shell | ||
Tests | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
Finder.php | ||
Glob.php | ||
LICENSE | ||
phpunit.xml.dist | ||
README.md | ||
SplFileInfo.php |
Finder Component
Finder finds files and directories via an intuitive fluent interface.
use Symfony\Component\Finder\Finder;
$finder = new Finder();
$iterator = $finder
->files()
->name('*.php')
->depth(0)
->size('>= 1K')
->in(__DIR__);
foreach ($iterator as $file) {
print $file->getRealpath()."\n";
}
But you can also use it to find files stored remotely like in this example where we are looking for files on Amazon S3:
$s3 = new \Zend_Service_Amazon_S3($key, $secret);
$s3->registerStreamWrapper("s3");
$finder = new Finder();
$finder->name('photos*')->size('< 100K')->date('since 1 hour ago');
foreach ($finder->in('s3://bucket-name') as $file) {
print $file->getFilename()."\n";
}
Resources
You can run the unit tests with the following command:
$ cd path/to/Symfony/Component/Finder/
$ composer.phar install --dev
$ phpunit