kekrozsak/vendor/symfony/symfony/src/Symfony/Component/Finder
Polonkai Gergely b82b4ffd34 Made document editing possible 2012-07-22 19:38:00 +02:00
..
Comparator Initial commit with Symfony 2.1+Vendors 2012-07-01 09:52:20 +02:00
Iterator Updated to Symfony 2.1 BETA3 2012-07-16 21:40:19 +02:00
Tests Updated to Symfony 2.1 BETA3 2012-07-16 21:40:19 +02:00
CHANGELOG.md Upgraded to Symfony 2.1-beta2 2012-07-15 14:56:31 +02:00
Finder.php Made document editing possible 2012-07-22 19:38:00 +02:00
Glob.php Updated to Symfony 2.1 BETA3 2012-07-16 21:40:19 +02:00
LICENSE Initial commit with Symfony 2.1+Vendors 2012-07-01 09:52:20 +02:00
README.md Initial commit with Symfony 2.1+Vendors 2012-07-01 09:52:20 +02:00
SplFileInfo.php Updated to Symfony 2.1 BETA3 2012-07-16 21:40:19 +02:00
composer.json Initial commit with Symfony 2.1+Vendors 2012-07-01 09:52:20 +02:00
phpunit.xml.dist Initial commit with Symfony 2.1+Vendors 2012-07-01 09:52:20 +02:00

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

You can run the unit tests with the following command:

phpunit