PHPackages                             chsxf/folder-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. chsxf/folder-watcher

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

chsxf/folder-watcher
====================

Watches a folder's content and calls to responders when changes are found

0.2.0(1y ago)013MITPHPPHP &gt;=8.1

Since Feb 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/chsxf/folder-watcher)[ Packagist](https://packagist.org/packages/chsxf/folder-watcher)[ Docs](https://github.com/chsxf/folder-watcher)[ RSS](/packages/chsxf-folder-watcher/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (5)Used By (0)

About
=====

[](#about)

This package allows watching folders for any change and being notified when it happens.

PHP does not implement native filesystem watchers so the package basically maps the content of the watched folders and rescan them regularly to identify any potential change.

This package has been initially developed to help monitoring file changes within a website static generator tool and improve workflow.

[![](https://camo.githubusercontent.com/52fcb9b6c254a40ca4ac0981132a291705038af46ca7cd3cc21fa9e5add01bda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312532422d374138364238)](https://camo.githubusercontent.com/52fcb9b6c254a40ca4ac0981132a291705038af46ca7cd3cc21fa9e5add01bda/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e312532422d374138364238)[![](https://camo.githubusercontent.com/c93f2672fae073162950404b6f9d6e92615f1701010e6fb43a871bde024db7ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6769746d6f6a692d2532302546302539462539382539432532302546302539462539382538442d4646444436372e737667)](https://gitmoji.dev/)[![](https://camo.githubusercontent.com/8c28955de81e48d4f233b74d78dda232ec7936f7bd1aad1382aad0debd05adee/68747470733a2f2f616e616c79746963732e63687378662e6465762f47697448756253746174732e62616467652f666f6c6465722d776174636865722f524541444d452e6d64)](https://camo.githubusercontent.com/8c28955de81e48d4f233b74d78dda232ec7936f7bd1aad1382aad0debd05adee/68747470733a2f2f616e616c79746963732e63687378662e6465762f47697448756253746174732e62616467652f666f6c6465722d776174636865722f524541444d452e6d64)

Requirements
============

[](#requirements)

This package requires PHP 8.1+ but has no other dependency.

Installation
============

[](#installation)

Use [Composer](https://getcomposer.org/) to install the package:

```
composer require chsxf/folder-watcher
```

How to Use
==========

[](#how-to-use)

This package has been designed to be easy to use but flexible.

Instantiation
-------------

[](#instantiation)

```
require_once('vendor/autoload.php');

use chsxf\FolderWatcher\Runner;

// Instantiates the runner and configures the watched folders
// A second int parameter is available to set the refresh interval in milliseconds (set by default at 50 ms)
$runner = new Runner(['assets', 'templates']);
```

Reponders
---------

[](#reponders)

Changes are reported to "responders". A responder can be any object implementing the `IWatchResponder` interface or a simple callable that accepts an array as its single parameter.

Using a callable allows you respond to changes only and you won't receive any other messages that the `IWatchResponder` interface supports, like a notification at the start of a watch loop.

In both cases, changes are reported as an array of `WatchChange` objects.

```
function responderCallable(array $changes) {
    // Do something with the array
}

$runner->addResponder(responderCallable(...));
```

Watching
--------

[](#watching)

When everything is configured, you can start watching for changes.

Important

This will effectively send your PHP process in an infinite loop, interrupted periodically by sleeping for how many milliseconds you've set as the refresh interval, or to notify your responders of any changes.

```
$runner->watch();
```

Stopping
--------

[](#stopping)

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

Support
=======

[](#support)

This package is under active development.

However, support is not guaranteed in any way. [Pull requests](https://github.com/chsxf/folder-watcher/pulls) or [issues](https://github.com/chsxf/folder-watcher/issues) are welcomed but you may wait for some time before getting any answer.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance42

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Total

3

Last Release

472d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

composercomposer-packagefilesystemfilesystemwatcherpackagephp

### Embed Badge

![Health badge](/badges/chsxf-folder-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/chsxf-folder-watcher/health.svg)](https://phpackages.com/packages/chsxf-folder-watcher)
```

PHPackages © 2026

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