Download the PHP package ahmadelsaeed/php8-resource-watcher without Composer
On this page you can find all versions of the php package ahmadelsaeed/php8-resource-watcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ahmadelsaeed/php8-resource-watcher
More information about ahmadelsaeed/php8-resource-watcher
Files in ahmadelsaeed/php8-resource-watcher
Package php8-resource-watcher
Short Description A simple resource watcher using Symfony Finder
License MIT
Homepage http://yosymfony.com
Informations about the package php8-resource-watcher
A simple resource watcher for getting changes of your filesystem.
Installation
Use Composer to install this package:
How to use?
This package uses Symfony Finder to set the criteria to discover file 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
Two hashing classes are included in the package:
Yosymfony\ResourceWatcher\Crc32ContentHash
, which hashes the content of the fileYosymfony\ResourceWatcher\Crc32MetaDataHash
, which hashes the filename and its last modified timestamp
Rebuild cache
To rebuild the resource cache uses rebuild()
method of the class ResourceWatcher
.
Relative paths with the resource cache
Using relative paths with the resource cache is possible thanks to the
ResourceWatcher's method enableRelativePathWithCache
:
The ResourceWatcherResult
object will has relative paths.
Unit tests
You can run the unit tests with the following command: