watcherphp / watcher
Watcher: Effortlessly Track and Manage Your File Changes Seamlessly
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Language:HTML
pkg:composer/watcherphp/watcher
Requires
- php: ^8.1
- symfony/console: ^7.2
- symfony/filesystem: ^7.2
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.0
This package is auto-updated.
Last update: 2025-11-09 02:50:23 UTC
README
- Task not completed
- Task completed
Full Code:
$file = $argv[1]; $lastModified = filemtime($file); echo "Watching $file for changes...\n"; while(true){ clearstatcache(); $currentModified = filemtime($file); if ($currentModified !== $lastModified) { echo "File changed, restarting script...\n"; shell_exec("php $file"); $lastModified = $currentModified; } sleep(1); }
File Watch Run
php watch index.php