PHPackages                             seregazhuk/reactphp-fswatch - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. seregazhuk/reactphp-fswatch

ActiveLibrary[File &amp; Storage](/categories/file-storage)

seregazhuk/reactphp-fswatch
===========================

Library for monitoring file changes with fswatch and ReactPHP

v1.1.1(8mo ago)86.0k2MITPHPPHP &gt;=8.1CI failing

Since May 18Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/seregazhuk/reactphp-fswatch)[ Packagist](https://packagist.org/packages/seregazhuk/reactphp-fswatch)[ RSS](/packages/seregazhuk-reactphp-fswatch/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (8)Versions (7)Used By (0)

Watch files for changes with fswatch and ReactPHP.
==================================================

[](#watch-files-for-changes-with-fswatch-and-reactphp)

[![PHP Version](https://camo.githubusercontent.com/13e3f7b21b3db9f6346d833a942214e9d979c14738656d02fb31ae7e2421e815/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7365726567617a68756b2f72656163747068702d667377617463682e737667)](https://php.net/)[![Total Downloads](https://camo.githubusercontent.com/24b80b93f273aa784e19c440dc76f46c32b3c72f87cc85d5311bb340f160f33b/68747470733a2f2f706f7365722e707567782e6f72672f7365726567617a68756b2f72656163747068702d667377617463682f646f776e6c6f616473)](https://packagist.org/packages/seregazhuk/reactphp-fswatch)

[![Latest Stable Version](https://camo.githubusercontent.com/1094a3795e791988972466b6785d4bab6bd7ee48360d4f5e4d264c5986216096/68747470733a2f2f706f7365722e707567782e6f72672f7365726567617a68756b2f72656163747068702d667377617463682f762f737461626c65)](https://packagist.org/packages/seregazhuk/reactphp-fswatch)[![Latest Version](https://camo.githubusercontent.com/12770449b989b4d4195d2a6d5c51345ec6628bd2e6064e60d545f0477f6e88b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365726567617a68756b2f72656163747068702d667377617463682e737667)](https://packagist.org/packages/seregazhuk/reactphp-fswatch)[![Latest Unstable Version](https://camo.githubusercontent.com/a54bca061f29047a4ab37a5de4c8ab03b238ac75426bae0daae9b0979c84f5a7/68747470733a2f2f706f7365722e707567782e6f72672f7365726567617a68756b2f72656163747068702d667377617463682f762f756e737461626c65)](https://packagist.org/packages/seregazhuk/reactphp-fswatch)

[![License](https://camo.githubusercontent.com/5dde6d529dafa7846b6c0b0ae62c4c620e1311904317d41bfd561b5409b1c765/68747470733a2f2f706f7365722e707567782e6f72672f7365726567617a68756b2f72656163747068702d667377617463682f6c6963656e7365)](https://packagist.org/packages/seregazhuk/reactphp-fswatch)

**Table of contents**

- [Installation](#installation)
- [Usage](#usage)
- [Filesystem Changes](#filesystem-changes)

Installation
------------

[](#installation)

Library requires [fswatch](https://github.com/emcrisostomo/fswatch) - a cross-platform file change monitor with multiple environments.

You can install this package like this:

```
composer global seregazhuk/reactphp-fswatch
```

Usage
-----

[](#usage)

First of all, you create a *watcher* object providing a loop and fswatch command that you are going to run. For example if you want to listen to changes inside `src` directory:

```
$watcher = new \Seregazhuk\ReactFsWatch\FsWatch('src');
$watcher->run();
```

Once there are changes in the directory the watcher fires `change` event that contains an instance of `Change` object. To detect change you can listen to this event and handle the event object:

```
$watcher->on(
    'change',
    static function (Change $event) {
        $type = $event->isFile() ? 'File' : 'Dir';
        echo $type . ': ' . $event->file() . ' was changed' . PHP_EOL;
    }
);
```

Also, you can use a helper method `onChange`:

```
$watcher->onChange($callable);
```

To stop listening for filesytem use method `stop()`:

```
$watcher->stop();
```

Filesystem Changes
------------------

[](#filesystem-changes)

On every change you receive `Change` object that contains different details about an event that happened in the filesystem. It has the following helper methods to examine the change:

- `file()` - filename or a directory that has changed.
- `isFile()` - whether a file was changed or not.
- `isDir()` - whether a directory was changed or not.
- `isSymbolicLink` - whether a symbolic link was changed or not.
- `isLink()` - the object link count has changed.
- `noOp()` - no changed were detected.
- `attributeModified()` - the object’s attribute has changed.
- `ownerModified()` - the object’s owner has changed.
- `created()` - the object has been created.
- `removed()` - the object has been removed.
- `renamed()` - the object has been renamed.
- `updated()` - the object has been updated.

License
=======

[](#license)

MIT

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance60

Regular maintenance activity

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity69

Established project with proven stability

 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 ~992 days

Total

3

Last Release

253d ago

Major Versions

v0.1.0 → v1.0.02025-10-23

PHP version history (2 changes)v0.1.0PHP ^7.4

v1.0.0PHP &gt;=8.1

### Community

Maintainers

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

---

Top Contributors

[![seregazhuk](https://avatars.githubusercontent.com/u/9959761?v=4)](https://github.com/seregazhuk "seregazhuk (27 commits)")

---

Tags

phpasynchronousfilesystemreactphpfswatch

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/seregazhuk-reactphp-fswatch/health.svg)

```
[![Health](https://phpackages.com/badges/seregazhuk-reactphp-fswatch/health.svg)](https://phpackages.com/packages/seregazhuk-reactphp-fswatch)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[team-reflex/discord-php

An unofficial API to interact with the voice and text service Discord.

1.1k420.9k26](/packages/team-reflex-discord-php)[react/filesystem

Asynchronous filesystem abstraction.

141237.3k16](/packages/react-filesystem)

PHPackages © 2026

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