PHP code example of cocur / watchman

1. Go to this page and download the library: Download cocur/watchman 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/ */

    

cocur / watchman example snippets


use Cocur\Watchman\Watchman;

$watchman = new Watchman();
$watch = $watchman->addWatch('/var/www/foobar');
$trigger = $watch->addTrigger('foo', '*.js', 'ls -al');

// Retrieve all watched directories
$watched = $watchman->listWatches();

// Retrieve all triggers from a watch
$triggers = $watch->listTriggers();

// Later...
$trigger->delete();
$watch->delete();