2017 © Pedro PelĂĄez
 

library fswatcher

PHP File System Watcher

image

gonzalo123/fswatcher

PHP File System Watcher

  • Monday, November 26, 2012
  • by gonzalo123
  • Repository
  • 2 Watchers
  • 1 Stars
  • 23 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Filesystem watcher with PHP, (*1)

Build Status, (*2)

Actualy only works with Linux. Uses inotifywait to detect modifications and ÉvĂ©nement to manage events, (*3)

One usage example:, (*4)

<?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();

The Versions