1. Go to this page and download the library: Download brunonatali/inotify 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/ */
brunonatali / inotify example snippets
use BrunoNatali\Inotify\Factory;
use React\EventLoop\Factory as LoopFactory;
$loop = LoopFactory::create();
try {
$notify = new Factory($loop);
} catch ($e \Exception) {
/**
* Exception codes:
* EXCEPTION_EXTENSION_LOAD -> Extension is not loaded
* EXCEPTION_EXTENSION_INIT -> inotify initialization error
*/
}
$filePathName = __FILE__;
$notify->add($filePathName, IN_ATTRIB);
$notify->on(IN_ATTRIB, function () {
echo "File touched";
});