mkraemer/react-inotify 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mkraemer/react-inotify

最新稳定版本:v1.1.0

Composer 安装命令:

composer require mkraemer/react-inotify

包简介

Inotify bindings for ReactPHP

README 文档

README

Basic inotify bindings for React PHP.

##Install This library requires PHP5.3 and the inotify PECL extension. The best way to install this library is through composer:

{
    "require": {
        "mkraemer/react-inotify": "1.1.0"
    }
}

Usage

This library provides the Inotify class which takes an event loop and optionally the timer interval in which the inotify events should be checked as constructor arguments. After initializing the class, you can use the add() method to add paths to the list of watched paths. Use the inotify bitmasks to define to which filesystem operations to listen.

<?php

$loop = React\EventLoop\Factory::create();
$inotify = new MKraemer\ReactInotify\Inotify($loop);

$inotify->add('/tmp/', IN_CLOSE_WRITE | IN_CREATE | IN_DELETE);
$inotify->add('/var/log/', IN_CLOSE_WRITE | IN_CREATE | IN_DELETE);

$inotify->on(IN_CLOSE_WRITE, function ($path) {
    echo 'File closed after writing: '.$path.PHP_EOL;
});

$inotify->on(IN_CREATE, function ($path) {
    echo 'File created: '.$path.PHP_EOL;
});

$inotify->on(IN_DELETE, function ($path) {
    echo 'File deleted: '.$path.PHP_EOL;
});

$loop->run();

统计信息

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

GitHub 信息

  • Stars: 46
  • Watchers: 4
  • Forks: 14
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-02-01