kompakt / directory-runner
There is no license information available for the latest version (1.1.2) of this package.
Run through a directory with event-emitting along the way
1.1.2
2018-09-01 15:57 UTC
Requires
- php: >=5.4.0
- monolog/monolog: ~1.12
- symfony/console: ~2.8|~3.0|~4.0
- symfony/event-dispatcher: ~2.8|~3.0|~4.0
Requires (Dev)
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2025-01-07 03:54:44 UTC
README
Run through a directory with event-emitting along the way.
Install
Through Composer:
composer require kompakt/directory-runner
Example
Iterate over all json
files in a given directory:
use Kompakt\DirectoryRunner\Subscriber\Debugger; use Kompakt\DirectoryRunner\Runner; use Kompakt\DirectoryRunner\EventNames; use Symfony\Component\EventDispatcher\EventDispatcher; $dir = 'path/to/dir'; $dispatcher = new EventDispatcher(); $eventNames = new EventNames(); $runner = new Runner($dispatcher, $eventNames, $dir); $debugger = new Debugger($dispatcher, $eventNames); $debugger->activate(); $callback = function($fileInfo) { return preg_match('/\.json$/', $fileInfo->getFilename()); }; $runner->run($callback);
License
kompakt/directory-runner is licensed under the MIT license - see the LICENSE file for details