定制 stikmanw/file-event-watcher 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stikmanw/file-event-watcher

最新稳定版本:v0.1.0

Composer 安装命令:

composer require stikmanw/file-event-watcher

包简介

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

README 文档

README

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

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:

  • 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

use Stikman\FileWatcher; 

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

Set the pulling interval

$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

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

License

MIT

统计信息

  • 总下载量: 220
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-06-24