The PhpGuard\Listen
listens to any filesystem events and notifies you about the changes.
$ cd /paths/to/project
$ composer require --dev phpguard/listen "dev-master"
use PhpGuard\Listen\Listen;
use PhpGuard\Listen\Event\FilesystemEvent;
use PhpGuard\Listen\Event\ChangeSetEvent;
$listen = new Listen();
$listener = $listen->to('/path/to/project') // returns the listener objects
->paths('/foobar') // add path to listen
->ignores('*.html') // ignore file
->patterns('#^src\/*.\.php#')
->patterns('#^spec\/*.\.php#')
->callbacks(function(ChangeSetEvent $event){
foreach($event->getFilesystemEvents() as $fse){
echo sprintf(
'mode:"%s", paths: "%s",
$fse->getHumanType,
$fse->get()->getRelativePath(),
);
}
});
$listen->start();