Jordi Boggiano f3408ccf2c [Finder] Avoid unnecessary use of the @ operator há 13 anos atrás
..
Comparator f3408ccf2c [Finder] Avoid unnecessary use of the @ operator há 13 anos atrás
Iterator 1aabc5da64 fixed CS há 14 anos atrás
Finder.php 15910a015b fixed coding standards há 13 anos atrás
Glob.php 8c0beea677 [Phpdoc] Cleaning/fixing há 14 anos atrás
LICENSE 89868f7901 Updated LICENSE files copyright há 13 anos atrás
README.md 997f354d53 tweaked the README files há 13 anos atrás
SplFileInfo.php 8c0beea677 [Phpdoc] Cleaning/fixing há 14 anos atrás
composer.json 208c2e468c removed the version attribute in all composer.json files há 13 anos atrás

README.md

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

Unit tests:

https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Finder