Download the PHP package nivpenso/react-file-watcher without Composer
On this page you can find all versions of the php package nivpenso/react-file-watcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nivpenso/react-file-watcher
More information about nivpenso/react-file-watcher
Files in nivpenso/react-file-watcher
Package react-file-watcher
Short Description a file watcher package based on reactphp
License MIT
Informations about the package react-file-watcher
ReactPHP File Watcher
About
This package is based on reactphp/event-loop and provides an easy-to-use interface to set filesystem watchers and detect changes.
More in depth
The package is utilizing the abstraction of react-php to create an efficient file-watcher using the underlying platform package that is installed on the environment
Support
Extension | Status |
---|---|
ext-uv | Supported |
ext-ev | Supported |
ext-libevent | Supported (using in default watcher) |
ext-event | Supported (using in default watcher) |
ext-libev | Supported (using in default watcher) |
How to install
How to use
code snippet
Demo
This package comes with a demo that can be used. feel free to run it
Running the demo on local (Linux)
- make sure one of the supported libraries is installed on your environment (suggested:
ext-uv
) - run the following commands
After the process started you can start changing files under the path to watch (default: /tmp
) and see the messages in the terminal.
Running the demo on Docker
In case you don't have a linux machine ready, or an environment set up you can use Docker to test it.
make a change inside the tmp folder of the container to see the change detection
On the first terminal you should see the process detect the change.
Testing
This package comes with tests in it. It uses the amazing package, PEST. You can either run the tests on local or use the provided docker file that already contains a ready to use environment with all the required extensions (ev
, uv
, libevent
, event
).