PHP code example of penguin / fswatch
1. Go to this page and download the library: Download penguin/fswatch library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
penguin / fswatch example snippets
use Penguin\Component\FsWatch\FsWatch;
use poll_monitor (default is inotify in Linux, FSEvents in MacOS)
// ignore files json, txt with regex
->ignore('.*\.json')
->ignore('.*\.txt')
->onChange(function (string $path) {
echo "onChange {$path}";
});