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

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

linaphp/resource-watcher
========================

A simple resource watcher using Symfony Finder

v0.1.2(2y ago)03232MITPHPPHP &gt;8.2

Since Apr 7Pushed 2y agoCompare

[ Source](https://github.com/linaphp/resource-watcher)[ Packagist](https://packagist.org/packages/linaphp/resource-watcher)[ Docs](http://lina.daudau.cc)[ RSS](/packages/linaphp-resource-watcher/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (3)Versions (4)Used By (2)

A simple resource watcher for getting changes of your filesystem.

\*\* This is a fork of the original package by [Yosymfony](https://github.com/yosymfony/resource-watcher). \*\*

[![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 linaphp/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 LinaPhp\ResourceWatcher\Crc32ContentHash;
use LinaPhp\ResourceWatcher\ResourceWatcher;
use LinaPhp\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:

- `LinaPhp\ResourceWatcher\Crc32ContentHash`, which hashes the content of the file
- `LinaPhp\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

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

806d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5652494?v=4)[Nguyen Viet](/maintainers/bangnokia)[@bangnokia](https://github.com/bangnokia)

---

Top Contributors

[![yosymfony](https://avatars.githubusercontent.com/u/3321099?v=4)](https://github.com/yosymfony "yosymfony (42 commits)")[![bangnokia](https://avatars.githubusercontent.com/u/5652494?v=4)](https://github.com/bangnokia "bangnokia (12 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/linaphp-resource-watcher/health.svg)

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

###  Alternatives

[yosymfony/resource-watcher

A simple resource watcher using Symfony Finder

698.6M22](/packages/yosymfony-resource-watcher)[illuminate/filesystem

The Illuminate Filesystem package.

15263.8M3.0k](/packages/illuminate-filesystem)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[api-platform/symfony

Symfony API Platform integration

354.0M110](/packages/api-platform-symfony)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)

PHPackages © 2026

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