PHP code example of brash / phpwatcher

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

    

brash / phpwatcher example snippets


use Brash\PhpWatcher\Bootstrapper;
use Brash\PhpWatcher\Watcher;
use Brash\PhpWatcher\WatchEvent;
use Revolt\EventLoop;

/ Do anything to event
    });

$watcher->start();

// Not REALLY necessary, since when this process ends all children process must end too.
EventLoop::onSignal(SIGINT, fn () => $watcher->stop());

EventLoop::run();


function Watcher::on(
    EffectEventWatchEnum[] $effects,
    PathTypeEnum[] $types,
    callable $callable
): Watcher;

$watcher->shouldContinue(fn () => false);


$watcher->setIntervalTime(1); // in seconds