2017 © Pedro Peláez
 

libarary file-event-watcher

File system watcher allowing for observeable handlers when a directory changes or content of the directory changes.

image

stikmanw/file-event-watcher

File system watcher allowing for observeable handlers when a directory changes or content of the directory changes.

  • Wednesday, June 24, 2015
  • by bdcarter42
  • Repository
  • 1 Watchers
  • 0 Stars
  • 148 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 9 % Grown

The README.md

Watcher Build Status

File system watcher allowing for observeable handlers when a directory changes or content of the directory changes., (*1)

Requirements

  • PHP 5.4 >=
  • Linux Files System / Mac OSX tested
  • Windows (untested)

Description

You used the file FileWatcher like you would use typical event listener. The main advantage to this class is it does not require installing any additional libraries and can simply be installed via composer and used immidiately. You can attach multiple listeners to the 3 main events:, (*2)

  • CREATE - File has been created
  • MODIFIED - File has been changed (currently uses a md5 hash to identify change)
  • DELETE - File has been deleted since last check

Example

Attach to create events, (*3)

use Stikman\FileWatcher; 

$watcher = new FileWatcher("/tmp/mystuff"); 
$watcher->on(FileWatcher::CREATE, function() {
  // do stuff 
}); 

Set the pulling interval, (*4)

$watcher = new FileWatcher("/tmp/mystuff"); 
$watcher->setInterval(100); // 100 millioseconds to check disk defaults to 25ms

Custom pattern match against file system for monitoring configuration data, (*5)

$watcher = new FileWatcher("/tmp/mystuff", "*.json"); 

License

MIT, (*6)

The Versions

24/06 2015

dev-master

9999999-dev

File system watcher allowing for observeable handlers when a directory changes or content of the directory changes.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ben Carter

24/06 2015

v0.1.0

0.1.0.0

File system watcher allowing for observeable handlers when a directory changes or content of the directory changes.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ben Carter