use Task\Plugin\WatchPlugin;
$project->inject(function ($container) {
$container['watch'] = new WatchPlugin;
});
$project->addTask('watch', ['watch', function ($watch) {
$watch->init('/tmp')
->addListener('modify', function ($event) {
# Do something
});
}]);
Add to composer.json
:
...
"require-dev": {
"task/watch": "~0.1"
}
...
See the documentation for mbfisher/watch for documentation on using the watchers.