PHP code example of azjezz / assess

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

    

azjezz / assess example snippets


use Assess\Configuration;
use Assess\Event\Event;
use Assess\Event\EventType;
use Assess\Watcher;
use Revolt\EventLoop;

$configuration = Configuration::createForDirectories([
    '/path/to/directory',
    '/another/path/to/directory',
])
    // poll interval in seconds
    ->withPollInterval(0.5)
    // do not watch directories
    ->withWatchDirectories(false)
    // $newNode = $event->newIndex->nodes[$event->id];

    echo "File moved: {$oldNode->path} -> {$newNode->path}\n";
});

$watcher->register(EventType::Deleted, function (Event $event): void {
    $node = $event->oldIndex->nodes[$event->id];

    echo "File deleted: {$node->path}\n";
});

$watcher->enable();
$watcher->reference();

EventLoop::run();