gonzalo123 / fswatcher
PHP File System Watcher
Installs: 23
Dependents: 1
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/gonzalo123/fswatcher
Requires
- php: >=5.4.0
- evenement/evenement: 2.0.*
- gonzalo123/sh: dev-master
- symfony/process: dev-master
This package is not auto-updated.
Last update: 2025-09-27 18:15:49 UTC
README
Filesystem watcher with PHP
Actualy only works with Linux. Uses inotifywait to detect modifications and Événement to manage events
One usage example:
<?php include __DIR__ . '/../vendor/autoload.php'; use FsWatcher\Watcher; use Sh\Sh; $directoryToWatch = './'; $sh = new Sh(); $watcher = Watcher::factory($directoryToWatch); $watcher->registerExtensionToWatch('php'); $watcher->onSave(function ($file) use ($sh) { echo $sh->php("-l {$file}"); echo "\n"; }); $watcher->onDelete(function ($file) { echo "DELETED: {$file}\n"; }); $watcher->onCreate(function ($file) { echo "CREATED: {$file}\n"; }); $watcher->start();