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:
  Little correction for case 'ar'
  No need to use mb functions here
  Fix doc-blocks
  Fix doc blocks
  [HttpFoundation] update phpdoc of SessionHandlerInterface and unify parameters of all handlers according to interface
  [Doctrine Bridge] fix DbalSessionHandler for high concurrency, interface compliance, compatibility with all drivers (oci8, mysqli, pdo with mysql, sqlsrv, sqlite)
  [Finder] Marked test skipped when ftp stream wrapper is not available

Conflicts:
	src/Symfony/Component/Security/Core/Authorization/Voter/ExpressionVoter.php
latest commit b1c92e9798
Fabien Potencier fabpot authored April 18, 2014
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 18, 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.