PHPackages                             ralfhortt/php-watch-files - 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. ralfhortt/php-watch-files

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

ralfhortt/php-watch-files
=========================

Watch file or folder and execute code when something is changes inside

1.0.0(4y ago)0101MITPHP

Since Apr 16Pushed 4y agoCompare

[ Source](https://github.com/Horttcore/php-file-watcher)[ Packagist](https://packagist.org/packages/ralfhortt/php-watch-files)[ RSS](/packages/ralfhortt-php-watch-files/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (2)Used By (0)

php-file-watcher
================

[](#php-file-watcher)

Watch file or folder and execute code when something is changed inside

### Demo

[](#demo)

You can run the following command to see how the script works

```
php index.php FILE_OR_FOLDER_PATH
```

### Basic usage

[](#basic-usage)

```
$watcher = new \ralfhortt\fswatcher\Watcher('FILE_OR_FOLDER_PATH_TO_WATCH', function ($event) {
    // Do whatever you want when file or folder is changed.
    if ($event->isAddition()){
        // File was added and file path will be $event->file
    } else if ($event->isModification()){
        // File was modified and file path will be $event->file
    }
});
$watcher->watch();
```

### Advanced Usage

[](#advanced-usage)

```
$watcher = new \ralfhortt\fswatcher\Watcher('FILE_OR_FOLDER_PATH_TO_WATCH', 'callback', [
    'watchInterval' => 5,
    'cacheChanges' => true
]);
```

### Options

[](#options)

OptionDefault valueDescriptionwatchInterval1How often the file changes should be checkedcacheChangestrueGather file modifications in single check and trigger event once### Credits

[](#credits)

- The code is written by Zura Sekhniashvili
- I've repacked it as a composer package

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

1484d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/45d54752dcf3da868ffe4a5ad2b876d6acb911fd914700b52e4d4777ff7d4a02?d=identicon)[Ralf Hortt](/maintainers/Ralf%20Hortt)

---

Top Contributors

[![thecodeholic](https://avatars.githubusercontent.com/u/4627922?v=4)](https://github.com/thecodeholic "thecodeholic (9 commits)")

### Embed Badge

![Health badge](/badges/ralfhortt-php-watch-files/health.svg)

```
[![Health](https://phpackages.com/badges/ralfhortt-php-watch-files/health.svg)](https://phpackages.com/packages/ralfhortt-php-watch-files)
```

###  Alternatives

[spatie/opening-hours

A helper to query and format a set of opening hours

1.7k5.3M30](/packages/spatie-opening-hours)

PHPackages © 2026

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