PHPackages                             nivpenso/react-file-watcher - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. nivpenso/react-file-watcher

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nivpenso/react-file-watcher
===========================

a file watcher package based on reactphp

v0.2.0(5y ago)181.9k11MITPHP

Since Mar 3Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nivpenso/react-file-watcher)[ Packagist](https://packagist.org/packages/nivpenso/react-file-watcher)[ RSS](/packages/nivpenso-react-file-watcher/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (2)Dependencies (4)Versions (4)Used By (1)

ReactPHP File Watcher
=====================

[](#reactphp-file-watcher)

[![react-watcher-php](https://camo.githubusercontent.com/ab20d705b40be9ab071fff771ee8f00170b0d1f36b172c59ec269994eaf8a2fd/68747470733a2f2f636972636c6563692e636f6d2f67682f6e697670656e736f2f72656163742d66696c652d776174636865722e7376673f7374796c653d737667)](https://app.circleci.com/pipelines/github/nivpenso/react-file-watcher)[![codecov](https://camo.githubusercontent.com/6771a2a30daa988a705ae5fb88f01ae4bf50717c58efd510a0ac3bf57da69a0e/68747470733a2f2f636f6465636f762e696f2f67682f6e697670656e736f2f72656163742d66696c652d776174636865722f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d52505356533142463035)](https://codecov.io/gh/nivpenso/react-file-watcher)

### About

[](#about)

This package is based on [reactphp/event-loop](https://github.com/reactphp/event-loop) and provides an easy-to-use interface to set filesystem watchers and detect changes.

### More in depth

[](#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

[](#support)

ExtensionStatusext-uvSupportedext-evSupportedext-libeventSupported (using in default watcher)ext-eventSupported (using in default watcher)ext-libevSupported (using in default watcher)### How to install

[](#how-to-install)

```
composer require nivpenso/react-file-watcher

```

### How to use

[](#how-to-use)

#### code snippet

[](#code-snippet)

```
use React\EventLoop\Factory;
use ReactFileWatcher\FileWatcherFactory;
use ReactFileWatcher\PathObjects\PathWatcher;

// create path to watch in the file system
$pathToWatch = new PathWatcher("/tmp/", true);

// creating the loop using ReactPHP.
$loop = Factory::create();

// creating the file watcher based on the loop.
$fileWatcher = FileWatcherFactory::create($loop);

// call the watch and execute the callback when detecting change event.
$fsevent = $fileWatcher->Watch([$pathToWatch], function($filename) {
    var_dump($filename);
    print PHP_EOL;
});
```

### Demo

[](#demo)

This package comes with a demo that can be used. feel free to run it

#### Running the demo on local (Linux)

[](#running-the-demo-on-local-linux)

1. make sure one of the supported libraries is installed on your environment (suggested: `ext-uv`)
2. run the following commands

```
# install dependecies
composer install --no-dev
# run the demo
php ./demo/test.php

```

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

[](#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.

```
# In terminal A run this
docker-compose -f ./demo/docker-compose.yaml up

```

make a change inside the tmp folder of the container to see the change detection

```
# In terminal B run this
docker ps # to get the container-id
docker exec -it  /bin/bash
echo "change" > /tmp/1

```

On the first terminal you should see the process detect the change.

### Testing

[](#testing)

This package comes with tests in it. It uses the amazing package, [PEST](https://github.com/pestphp/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`).

#### running with PEST on local

[](#running-with-pest-on-local)

```
composer install
./vendor/bin/pest

```

#### using docker to run tests

[](#using-docker-to-run-tests)

```
docker-compose -f ./tests/docker-compose.yaml up

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

2

Last Release

1896d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd41ab02f664d6b4783f1bec9cc0fa1ddf55e47f7cc0be85087138178100069e?d=identicon)[nivpenso](/maintainers/nivpenso)

---

Top Contributors

[![nivpenso](https://avatars.githubusercontent.com/u/1158646?v=4)](https://github.com/nivpenso "nivpenso (8 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/nivpenso-react-file-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/nivpenso-react-file-watcher/health.svg)](https://phpackages.com/packages/nivpenso-react-file-watcher)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k234.7M20.6k](/packages/friendsofphp-php-cs-fixer)[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.6M63](/packages/react-react)[react/stream

Event-driven readable and writable streams for non-blocking I/O in ReactPHP

688126.8M194](/packages/react-stream)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34076.1M136](/packages/react-child-process)[react/zmq

ZeroMQ bindings for React.

2471.7M31](/packages/react-zmq)[carlosbuenosvinos/ddd

Domain-Driven Design PHP helper classes (Application Services, Transactions, Domain Events, etc.

665193.1k4](/packages/carlosbuenosvinos-ddd)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
