calcinai/rubberneck

Utility to monitor file system changes

Maintainers

Package info

github.com/calcinai/rubberneck

pkg:composer/calcinai/rubberneck

Statistics

Installs: 39

Dependents: 0

Suggesters: 0

Stars: 4

Open Issues: 0

v0.1.1 2016-02-06 01:54 UTC

This package is auto-updated.

Last update: 2026-02-22 11:46:18 UTC


README

A simple binding for ReactPHP event loops to watch files.

Currently only file poling and inotifywait in implemented, but is designed with stubs for other methods.

If possible, install inotifywait on your system, in Debian it's in the inotify-tools package. It is much more efficient than the file poll method.

#Usage

$loop = \React\EventLoop\Factory::create();
$observer = new \Calcinai\Rubberneck\Observer($loop);

$observer->onModify(function($file_name){
    echo "Modified: $file_name\n";
});

$observer->onCreate(function($file_name){
    echo "Created: $file_name\n";
});

$observer->onDelete(function($file_name){
    echo "Deleted: $file_name\n";
});


$observer->watch('~/Desktop/*.txt');

$loop->run();