Skip to content

gonzalo123/fswatcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Filesystem watcher with PHP

Build Status

Actualy only works with Linux. Uses inotifywait to detect modifications and Événement to manage events

One usage example:

<?php
include __DIR__ . '/../vendor/autoload.php';

use FsWatcher\Watcher;
use Sh\Sh;

$directoryToWatch = './';
$sh = new Sh();

$watcher = Watcher::factory($directoryToWatch);
$watcher->registerExtensionToWatch('php');

$watcher->onSave(function ($file) use ($sh) {
    echo $sh->php("-l {$file}");
    echo "\n";
});

$watcher->onDelete(function ($file) {
    echo "DELETED: {$file}\n";
});

$watcher->onCreate(function ($file) {
    echo "CREATED: {$file}\n";
});

$watcher->start();

About

Real time filesystem watcher with PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages