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

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

jefyokta/php-file-watcher
=========================

A lightweight native file watcher for PHP using FFI

v0.0.5(11mo ago)08MITC

Since Jun 6Pushed 11mo agoCompare

[ Source](https://github.com/jefyokta/php-file-watcher)[ Packagist](https://packagist.org/packages/jefyokta/php-file-watcher)[ RSS](/packages/jefyokta-php-file-watcher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

PHP File Watcher
================

[](#php-file-watcher)

Lightweight, cross-platform file watcher for **Linux** and **macOS** using native OS facilities (`inotify` on Linux, `kqueue` on macOS), exposed via PHP FFI.

---

Requirements
------------

[](#requirements)

- **Operating System:** Linux or macOS
- **PHP:** FFI extension enabled (`--enable-ffi` or `ffi.enable=1` in `php.ini`)
- **Composer:** for installation and autoloading

---

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

[](#installation)

Install the package via Composer:

```
composer require jefyokta/php-file-watcher
```

---

Usage
-----

[](#usage)

```
use Jefyokta\PhpFileWatcher\Watcher;

Watcher::onChange(function(string $file) {
    echo "File Changed: $file\n";
})->watch(__DIR__);
```

- `onChange(callable $callback)` — Register a callback to be invoked on each changed file.
- `watch(string $directory)` — Start watching the specified directory recursively.

---

Notes
-----

[](#notes)

- This package relies on PHP's FFI and a compiled native library (`libfilewatcher.so` or `.dylib`), so ensure the native library is built for your platform.
- Recursive watching of directories is supported.
- Suitable for lightweight monitoring in CLI PHP scripts or long-running daemons.

---

Build Native Library
--------------------

[](#build-native-library)

If you want to build the native library yourself:

```
./build.sh
```

This script detects your OS and compiles the appropriate C source code into the shared library.

---

License
-------

[](#license)

MIT License

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance52

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

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

Total

5

Last Release

337d ago

### Community

Maintainers

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

---

Top Contributors

[![jefyokta](https://avatars.githubusercontent.com/u/148698888?v=4)](https://github.com/jefyokta "jefyokta (7 commits)")

### Embed Badge

![Health badge](/badges/jefyokta-php-file-watcher/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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