Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

[READ-ONLY] Subtree split of the Symfony Finder Component -- clone into Symfony/Component/ (master at symfony/symfony)

Merge branch '2.4'

* 2.4:
  fixed types in phpdocs
  fixed types in phpdocs

Conflicts:
	src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php
	src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeServices.php
	src/Symfony/Component/Serializer/Encoder/JsonEncoder.php
	src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
	src/Symfony/Component/Validator/Mapping/ClassMetadata.php
	src/Symfony/Component/Validator/Mapping/ElementMetadata.php
	src/Symfony/Component/Validator/Mapping/MemberMetadata.php
	src/Symfony/Component/Validator/MetadataFactoryInterface.php
latest commit c946fec2cb
Fabien Potencier fabpot authored
Octocat-spinner-32 Adapter fixed types in phpdocs April 16, 2014
Octocat-spinner-32 Comparator fixed types in phpdocs April 16, 2014
Octocat-spinner-32 Exception Merge branch '2.2' April 22, 2013
Octocat-spinner-32 Expression () is also a valid delimiter February 20, 2014
Octocat-spinner-32 Iterator Merge branch '2.4' April 16, 2014
Octocat-spinner-32 Shell Merge branch '2.3' into 2.4 April 16, 2014
Octocat-spinner-32 Tests Merge branch '2.4' April 16, 2014
Octocat-spinner-32 .gitignore Added missing files .gitignore July 21, 2013
Octocat-spinner-32 CHANGELOG.md [Finder] Included GLOB_BRACE support in the CHANGELOG. January 01, 2014
Octocat-spinner-32 Finder.php Merge branch '2.4' April 16, 2014
Octocat-spinner-32 Glob.php made phpdoc types consistent with those defined in Hack April 15, 2014
Octocat-spinner-32 LICENSE update year on licenses January 07, 2014
Octocat-spinner-32 README.md updated the composer install command to reflect changes in Composer September 18, 2013
Octocat-spinner-32 SplFileInfo.php [Finder] Fix SplFileInfo::getContents isn't working with ssh2 protocol June 10, 2013
Octocat-spinner-32 composer.json updated version to 2.5 November 24, 2013
Octocat-spinner-32 phpunit.xml.dist made usage of Composer autoloader for subtree-split unit tests November 09, 2012
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:

$ cd path/to/Symfony/Component/Finder/
$ composer.phar install
$ phpunit
Something went wrong with that request. Please try again.