I am using Symfony Standard Edition and trying to get the Symfony Finder component as a service, but could not find it. To use the Finder, I need to create it manually, for example:
$finder = new Symfony\Component\Finder\Finder();
Why can't I get it from the service container? Was it wrong?
PS The Symfony file system component exists in the service container and is accessible by name filesystem.
filesystem
The Symfony Finder component is a stand-alone component; it is not part of the FileSystem component:
"finder", Finder - , . , - , . , .
Finder ( ).
Yann Eugone . FinderService ServiceComponent .
services.yml
std.symfony_finder: class: Symfony\Component\Finder\Finder public: false std.your_service: class: Std\AppBundle\Services\YourService arguments: [@std.symfony_finder]
, ?
http://symfony.com/doc/current/components/finder.html
use Symfony\Component\Finder\Finder; $finder = new Finder(); $finder->files()->in(__DIR__); foreach ($finder as $file) { // Print the absolute path print $file->getRealpath()."\n"; // Print the relative path to the file, omitting the filename print $file->getRelativePath()."\n"; // Print the relative path to the file print $file->getRelativePathname()."\n"; }
.
{ "require": { "symfony/finder": "2.3.*" } }