phpguard/listen

The "PhpGuard Listen" listens to any filesystem events and notifies you about the changes.

0.1.0 2014-05-17 18:54 UTC

This package is not auto-updated.

Last update: 2024-04-13 13:09:46 UTC


README

Latest Stable Version Master Build Status Coverage Status Scrutinizer Code Quality

The PhpGuard\Listen listens to any filesystem events and notifies you about the changes.

Installing

$ cd /paths/to/project
$ composer require --dev phpguard/listen "dev-master"

Basic Usage

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();