PHPackages                             slick/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. slick/fswatch

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

slick/fswatch
=============

slick/fswatch is a simple library that sums the total size of all files in a given directory allowing you to verify if its contents have changed.

v0.1.0(2y ago)11.8k—0%3MITPHPPHP &gt;=8.2

Since May 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/slickframework/fswatch)[ Packagist](https://packagist.org/packages/slick/fswatch)[ RSS](/packages/slick-fswatch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (3)

Slick file system watch package
===============================

[](#slick-file-system-watch-package)

[![Latest Version](https://camo.githubusercontent.com/bce514462d7c59bbacf8d399bab3edf0a562fbc92118a027116336bb821b7254/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f736c69636b6672616d65776f726b2f667377617463682e7376673f7374796c653d666c61742d737175617265)](https://github.com/slickframework/fswatch/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/a17556e269b073317b4a51d7480553b6ce6714ca5d535db2eaed62753604f0b9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736c69636b6672616d65776f726b2f667377617463682f6d61696e2e79616d6c3f7374796c653d666c61742d737175617265)](https://github.com/slickframework/fswatch/actions/workflows/main.yaml)[![Quality Score](https://camo.githubusercontent.com/aa0f908b8f73f1948384ed8fad18819a7cf4af26f7394c2a1d4a763c90abf8d3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736c69636b6672616d65776f726b2f667377617463682f6d61696e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/slickframework/fswatch?branch=main)[![Contributor Covenant](https://camo.githubusercontent.com/ed53bffd2beeb96febb1ecf2944c292c1660a296bdde43ef7cfb0e911089de44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72253230436f76656e616e742d322e312d3462616161612e7376673f7374796c653d666c61742d737175617265)](CONDUCT.md)[![Total Downloads](https://camo.githubusercontent.com/013534bcc618755535061f765fa82aaca0db765664f524d5822503cdc677be11/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736c69636b2f667377617463682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/slick/fswatch)

`slick/fswatch` is a simple library that sums the total size of all files in a given directory allowing you to verify if its contents have changed.

This package is compliant with PSR-2 code standards and PSR-4 autoload standards. It also applies the [semantic version 2.0.0](http://semver.org) specification.

Install
-------

[](#install)

Via Composer

```
composer require slick/fswatch
```

Usage
-----

[](#usage)

First you need to create a directory snapshot to be able to compare it with any other changes later on:

```
use Slick\FsWatch\Directory;

$dir = new Directory('/path/to/directory');
// can be stored in any cache or temporary memory to be checked later
$snapshot = $dir->snapshot();
file_put_contents('/some/cache/file', serialize($snapshot));
```

Now you can verify if directory contents have changed:

```
use Slick\FsWatch\Directory;

$dir = new Directory('/path/to/directory');
$snapshot = unserialize(file_get_contents('/some/cache/file'))

if ($dir->hasChanged($snapshot)) { //directory contents have changed
    $changes = $dir->snapshot()->compareTo($snapshot);
    // do your logic
}
```

#### Using as a watcher

[](#using-as-a-watcher)

Using the same principle above, you can have a daemon like script that will execute a given callback whenever a file changes or is added to a given directory, recursively.

```
use Slick\FsWatch\Directory;
use Slick\FsWatch\Watcher;

$dir = new Directory('/path/to/directory');

$watcher = new Watcher($dir, function (Directory $dir) => {
    // do your logic on file change
});

// This will run until Ctrl + C (SIGINT) is pressed.
// You can pass an expression of callable to determine the end of the execution
$watcher->watch(Watcher::SIGINT);
```

Testing
-------

[](#testing)

```
phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Slick framework](https://github.com/slickframework)
- [All Contributors](https://github.com/slickframework/fswatch/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

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

737d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/101112?v=4)[fsilva](/maintainers/fsilva)[@fsilva](https://github.com/fsilva)

---

Top Contributors

[![silvamfilipe](https://avatars.githubusercontent.com/u/5720969?v=4)](https://github.com/silvamfilipe "silvamfilipe (34 commits)")

---

Tags

changesslickfile sistemwatch changes

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  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.8M125](/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)
