https://github.com/cydrickn/php-watcher
A simple directory and file watcher that was made using PHP.
https://github.com/cydrickn/php-watcher
php php-watcher watcher
Last synced: about 1 year ago
JSON representation
A simple directory and file watcher that was made using PHP.
- Host: GitHub
- URL: https://github.com/cydrickn/php-watcher
- Owner: cydrickn
- License: mit
- Created: 2022-08-26T14:00:48.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-06T13:52:55.000Z (over 1 year ago)
- Last Synced: 2025-04-03T11:51:16.284Z (about 1 year ago)
- Topics: php, php-watcher, watcher
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Watcher
A simple directory and file watcher that was made using PHP.
## Requirements
* PHP >= 8.1
## Installation
```shell
composer require cydrickn/php-watcher
```
## Usage
To use this package you just need to initialize the watcher and call the tick function
```php
tick();
```
## Adapters
Currently, we have 3 premade adapters:
### \Cydrickn\PHPWatcher\Adapters\SwooleTimerAdapter
If you are using Swoole/Openswoole then best choice to use this adapter
### \Cydrickn\PHPWatcher\Adapters\NativeAdapter
If not using Swoole/Openswoole then you can go for this one, it uses PHP's do-while and sleep
### \Cydrickn\PHPWatcher\Adapters\HybridAdapter
This is same as the version 1 where it will automatically use the SwooleTimerAdapter, if available or fallback to NativeAdapter.
This might be useful in a mixed environment.
## Custom Adapter
If you don't want to use any pre-made adapter you can create your own adapter.
Example:
```php