pkboom / file-watcher
Watch file changes
Installs: 4 855
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- symfony/finder: ^7.0
Requires (Dev)
- phpunit/phpunit: ^10.0
- symfony/var-dumper: ^7.0
README
Filewatcher is a simple file watcher. You can run a callback based on file changes.
use Pkboom\FileWatcher\FileWatcher; use React\EventLoop\Loop; $watcher = FileWatcher::create((new Finder())->in('dir')->files()); // or $watcher = FileWatcher::create('/path/to/file'); Loop::addPeriodicTimer(1, function () use ($watcher) { $watcher->find()->whenChanged(function () { // }); });
Installation
composer require pkboom/file-watcher