2025-11-10 13:36:25 +01:00
|
|
|
# Inotify library for ReactPHP
|
2026-01-09 15:47:44 +01:00
|
|
|
|
|
|
|
|
## Installing
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
$ composer repo add noccylabs composer https://dev.noccylabs.info/api/packages/noccylabs/composer
|
|
|
|
|
$ composer require noccylabs/react-inotify
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
// Create instance; you can pass a poll interval and a custom event loop.
|
|
|
|
|
$inotify = new NoccyLabs\React\Inotify\Inotify(0.1);
|
|
|
|
|
|
|
|
|
|
// Listen for events
|
|
|
|
|
$in->on("event", function ($event) {
|
|
|
|
|
var_dump($event);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Add a watch
|
|
|
|
|
$in->addWatch(__DIR__."/config", IN_CREATE|IN_DELETE|IN_MODIFY);
|
|
|
|
|
```
|