library fileon
A PHP file watcher
laudeon/fileon
A PHP file watcher
- Monday, October 17, 2016
- by laudeon
- Repository
- 1 Watchers
- 0 Stars
- 11 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 3 Versions
- 0 % Grown
fileon
PHP.7 file watcher, (*1)
Install
using composer: composer require laudeon/fileon, (*2)
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., (*3)
Watcher::isStopped():bool
Return the status of the watcher., (*4)
dev-master
9999999-dev
A PHP file watcher
Sources
Download
MIT
The Requires
watcher
file watcher
0.1.0
0.1.0.0
A PHP file watcher
Sources
Download
MIT
The Requires
watcher
file watcher
0.1.0.x-dev
0.1.0.9999999-dev
A PHP file watcher
Sources
Download
MIT
The Requires
watcher
file watcher