PHP code example of seregazhuk / reactphp-fswatch
1. Go to this page and download the library: Download seregazhuk/reactphp-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/ */
seregazhuk / reactphp-fswatch example snippets
$loop = \React\EventLoop\Factory::create();
$watcher = new \Seregazhuk\ReactFsWatch\FsWatch('src', $loop,);
$watcher->run();
$loop->run();
$watcher->on(
'change',
static function (Change $event) {
$type = $event->isFile() ? 'File' : 'Dir';
echo $type . ': ' . $event->file() . ' was changed' . PHP_EOL;
}
);
$watcher->onChange($callable);
$watcher->stop();
bash
composer global seregazhuk/reactphp-fswatch