2017 © Pedro Peláez
 

library swoole-watcher

Swoole file watcher.

image

huang-yi/swoole-watcher

Swoole file watcher.

  • Tuesday, December 19, 2017
  • by coodeer
  • Repository
  • 2 Watchers
  • 7 Stars
  • 617 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 26 % Grown

The README.md

Swoole Watcher

This package provides a file watcher., (*1)

Installation

The current version only supports fswatch, so you'll have to install fswatch first., (*2)

# MacOS
brew install fswatch

# Linux (building from Source)
wget https://github.com/emcrisostomo/fswatch/releases/download/{VERSION}/fswatch-{VERSION}.tar.gz
tar -xzvf fswatch-{VERSION}.tar.gz
cd fswatch-{VERSION} && ./configure && make && sudo make install && sudo ldconfig

A user who wishes to build fswatch should get a release tarball, (*3)

Then, make sure you have swoole extension installed in PHP., (*4)

pecl install swoole

Finally, you may install the Swoole Watcher via Composer:, (*5)

composer require huang-yi/swoole-watcher

Usage

Create your watcher script like this:, (*6)

<?php

require __DIR__ . '/vendor/autoload.php';

use HuangYi\Watcher\Commands\Fswatch;
use HuangYi\Watcher\Watcher;

$command = new Fswatch('/watched/path');

$command->setOptions([
    '--recursive' => true,
    '--filter-from' => '/path/to/filter-rules-file',
]);

$watcher = new Watcher($command);

// Registers a callback for an event.
$watcher->on(Fswatch::CREATED, function ($path) {
    // do something...
});

// or registers a default callback for any event.
$watcher->onChange(function ($events) {
    // do something...
});

$watcher->start();

License

Swoole Watcher is open-sourced software licensed under the MIT license., (*7)

The Versions

19/12 2017

dev-master

9999999-dev

Swoole file watcher.

  Sources   Download

MIT

The Development Requires

by Huang Yi

swoole watcher inotify

19/12 2017

0.0.2

0.0.2.0

Swoole file watcher.

  Sources   Download

MIT

The Development Requires

by Huang Yi

swoole watcher inotify

20/11 2017

0.0.1

0.0.1.0

Swoole file watcher.

  Sources   Download

MIT

The Development Requires

by Huang Yi

swoole watcher inotify

20/11 2017

0.1.x-dev

0.1.9999999.9999999-dev

Swoole file watcher.

  Sources   Download

MIT

The Development Requires

by Huang Yi

swoole watcher inotify