PHP code example of stikmanw / file-event-watcher

1. Go to this page and download the library: Download stikmanw/file-event-watcher 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/ */

    

stikmanw / file-event-watcher example snippets


use Stikman\FileWatcher; 

$watcher = new FileWatcher("/tmp/mystuff"); 
$watcher->on(FileWatcher::CREATE, function() {
  // do stuff 
}); 

$watcher = new FileWatcher("/tmp/mystuff"); 
$watcher->setInterval(100); // 100 millioseconds to check disk defaults to 25ms

$watcher = new FileWatcher("/tmp/mystuff", "*.json");