laudeon / fileon
This package is abandoned and no longer maintained.
No replacement package was suggested.
A PHP file watcher
0.1.0
2016-08-17 19:45 UTC
Requires
- php: >=7
- evenement/evenement: ^2.0
This package is not auto-updated.
Last update: 2021-04-16 06:41:27 UTC
README
PHP.7 file watcher
Install
using composer: composer require laudeon/fileon
Getting started
use Fileon\Resource; use Fileon\Watcher; $resource = new Resource(_DIR_); $watcher = new Watcher($resource); $watcher->onNew(function(\SplFileInfo $file){ //... }); $watcher->onModified(function(\SplFileInfo $file){ //... }); $watcher->watch(function() use ($watcher) { if(...) { $watcher->stop(); } });
API
Watcher
Watcher::__construct(Fileon\Resource $resource [, integer $sleep])
$resource
is an instance of Fileon\Resource.$sleep
, optional, is the sleep time on each loop turn of the watcher, in microseconds. Defautl is 1000000
Watcher::watch([, callable $callback):void
$callback
must be a callable argument (function). It will be executed at the end of each loop turn.
Watcher::stop():void
Stop the watcher.
Watcher::isStopped():bool
Return the status of the watcher.