PHPackages                             ahmadelsaeed/php8-resource-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. ahmadelsaeed/php8-resource-watcher

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

ahmadelsaeed/php8-resource-watcher
==================================

A simple resource watcher using Symfony Finder

1.1.1(3y ago)013MITPHPPHP ^7.2|^8.0

Since Aug 17Pushed 3y agoCompare

[ Source](https://github.com/ahmadelsaeed/php8-resource-watcher)[ Packagist](https://packagist.org/packages/ahmadelsaeed/php8-resource-watcher)[ Docs](http://yosymfony.com)[ RSS](/packages/ahmadelsaeed-php8-resource-watcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

A simple resource watcher for getting changes of your filesystem.

[![Build Status](https://camo.githubusercontent.com/d7faf9e84945fbdd1d8fd1552c47f6b7c56190bf046c174640625262b30c2a7c/68747470733a2f2f7472617669732d63692e6f72672f796f73796d666f6e792f7265736f757263652d776174636865722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/yosymfony/resource-watcher)[![Latest Stable Version](https://camo.githubusercontent.com/d6283aef88f431ef98383ab3568d8e1d80c4691976100c53e4f018c8eb5fa129/68747470733a2f2f706f7365722e707567782e6f72672f796f73796d666f6e792f7265736f757263652d776174636865722f762f737461626c652e706e67)](https://packagist.org/packages/yosymfony/resource-watcher)

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

[](#installation)

Use [Composer](http://getcomposer.org/) to install this package:

```
composer require yosymfony/resource-watcher
```

How to use?
-----------

[](#how-to-use)

This package uses [Symfony Finder](http://symfony.com/doc/current/components/finder.html)to set the criteria to discover file changes.

```
use Symfony\Component\Finder\Finder;
use Yosymfony\ResourceWatcher\Crc32ContentHash;
use Yosymfony\ResourceWatcher\ResourceWatcher;
use Yosymfony\ResourceWatcher\ResourceCachePhpFile;

$finder = new Finder();
$finder->files()
    ->name('*.md')
    ->in(__DIR__);

$hashContent = new Crc32ContentHash();
$resourceCache = new ResourceCachePhpFile('/path-cache-file.php');
$watcher = new ResourceWatcher($resourceCache, $finder, $hashContent);
$watcher->initialize();

// delete a file

$result = $watcher->findChanges();

$result->getDeletedResources() // array of deleted filenames. e.g: "/home/yosymfony/README.md"
```

### Finding changes

[](#finding-changes)

Every time the method `findChanges()` of the class `ResourceWatcher` is invoked, it returns an object type `ResourceWatcherResult` with information about all the changes producced in the filesystem. The `ResourceWatcherResult` class has the following methods:

- `getNewFiles()`: Returns an array with the paths of the new resources.
- `getDeteledFiles()`: Returns an array with the paths of deleted resources.
- `getUpdatedFiles()`: Returns an array with the paths of the updated resources.
- `hasChanges()`: Are they changes in your resources?.

### Hashing alternatives

[](#hashing-alternatives)

Two hashing classes are included in the package:

- `Yosymfony\ResourceWatcher\Crc32ContentHash`, which hashes the content of the file
- `Yosymfony\ResourceWatcher\Crc32MetaDataHash`, which hashes the filename and its last modified timestamp

### Rebuild cache

[](#rebuild-cache)

To rebuild the resource cache uses `rebuild()` method of the class `ResourceWatcher`.

### Relative paths with the resource cache

[](#relative-paths-with-the-resource-cache)

Using relative paths with the resource cache is possible thanks to the ResourceWatcher's method `enableRelativePathWithCache`:

```
$watcher = new ResourceWatcher($resourceCache, $finder, $hashContent);
$watcher->enableRelativePathWithCache()
```

The `ResourceWatcherResult` object will has relative paths.

Unit tests
----------

[](#unit-tests)

You can run the unit tests with the following command:

```
$ composer test
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 84% 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

3

Last Release

1361d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6

1.1.1PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/185787f91fb252432966061d80d5cb0dffbdd78e50e8f3654b857037d4fdb60f?d=identicon)[ahmadelsaeed](/maintainers/ahmadelsaeed)

---

Top Contributors

[![yosymfony](https://avatars.githubusercontent.com/u/3321099?v=4)](https://github.com/yosymfony "yosymfony (42 commits)")[![ahmadelsaeed](https://avatars.githubusercontent.com/u/3984838?v=4)](https://github.com/ahmadelsaeed "ahmadelsaeed (3 commits)")[![ArnaudLigny](https://avatars.githubusercontent.com/u/80580?v=4)](https://github.com/ArnaudLigny "ArnaudLigny (2 commits)")[![erikgaal](https://avatars.githubusercontent.com/u/1234268?v=4)](https://github.com/erikgaal "erikgaal (1 commits)")[![prudloff-insite](https://avatars.githubusercontent.com/u/50333926?v=4)](https://github.com/prudloff-insite "prudloff-insite (1 commits)")[![seregazhuk](https://avatars.githubusercontent.com/u/9959761?v=4)](https://github.com/seregazhuk "seregazhuk (1 commits)")

---

Tags

symfonyfinderwatcherresources

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ahmadelsaeed-php8-resource-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/ahmadelsaeed-php8-resource-watcher/health.svg)](https://phpackages.com/packages/ahmadelsaeed-php8-resource-watcher)
```

###  Alternatives

[yosymfony/resource-watcher

A simple resource watcher using Symfony Finder

698.2M22](/packages/yosymfony-resource-watcher)

PHPackages © 2026

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