https://github.com/arnaud-lb/php-inotify-ffi
Pure-PHP inotify binding (FFI-based)
https://github.com/arnaud-lb/php-inotify-ffi
Last synced: 8 months ago
JSON representation
Pure-PHP inotify binding (FFI-based)
- Host: GitHub
- URL: https://github.com/arnaud-lb/php-inotify-ffi
- Owner: arnaud-lb
- License: mit
- Created: 2020-12-18T15:37:24.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-08-01T11:28:09.000Z (over 1 year ago)
- Last Synced: 2024-08-02T12:23:25.521Z (over 1 year ago)
- Language: PHP
- Size: 15.6 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-inotify-ffi
php-inotify-ffi is a pure-PHP inotify binding based on FFI.
## Experimental / WIP
This is an experimental / WIP package. For a stable inotify binding, use [php-inotify](https://github.com/arnaud-lb/php-inotify).
## Goal
The goal of this package is to expose the raw inotify API to PHP, while being memory safe and preventing resource leaks.
## Streams
As the C inotify API returns file descriptors, this package returns PHP streams.
This is useful for the following reasons:
### I/O Polling
The streams can be used with polling mechanisms such as ``stream_select()`` or event loops such as ReactPHP or AMPHP. It's also possible to make the streams unblocking with ``stream_set_blocking()``.
### Resource management
As the inotify file descriptors are owned by PHP streams, they are managed by PHP. This ensures that the file descriptors are eventually closed, which prevents descriptor leaks.
## Comparison with the PECL extension
The [extension](https://github.com/arnaud-lb/php-inotify) is stable and has the same capabilities.