Download the PHP package myvon/reactphp-file-system-watcher without Composer

On this page you can find all versions of the php package myvon/reactphp-file-system-watcher. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package reactphp-file-system-watcher

reactphp-file-system-watcher

File System Watcher made with ReactPHP EventLoop and ChildProcess.

This is entirely based on spatie/file-system-watcher and adapted from symfony/process to react/child-process

Latest Version on Packagist Tests Total Downloads

Watch changes in the file system using PHP

This package allows you to react to all kinds of changes in the file system.

It use react/event-loop and react/child-process to run without blocking the rest of your code (see ReactPHP for more information).

Here's how you can run code when a new file gets added.

Installation

You can install the package via composer:

In your project, you should have the JavaScript package chokidar installed. You can install it via npm

or Yarn

Usage

Here's how you can start watching a directory and get notified of any changes.

You can pass as many directories as you like to path.

To start watching, call the start method.

To make sure that the watcher keeps watching in production, monitor the script or command that starts it with something like Supervisord.

Detected the type of change

The $type parameter of the closure you pass to onAnyChange can contain one of these values:

Listening for specific events

To handle file systems events of a certain type, you can make use of dedicated functions. Here's how you would listen for file creations only.

These are the related available methods:

You can pass multiple paths to the paths method.

Performing multiple tasks

You can call onAnyChange, 'onFileCreated', ... multiple times. All given closures will be performed

Stopping the watcher gracefully

By default, the watcher will continue indefinitely when started. There is two ways to gracefully stop the watcher :

Change the speed of watcher

By default, the changes are tracked every 0.5 seconds, however you could change that.

You can also specify the interval directly on the start.

Using another loop

By default, the watcher will use the default loop by calling Loop:get(). If needed, you can use another loop implemting LoopInterface interface of ReactPHP by passing it as the first argument of start:

Notice: the watcher will register the needed timer but won't start the loop, don't forget to start it.

You also can look into test/WatchTest.php to see how it is used to have one loop by test

Testing

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


All versions of reactphp-file-system-watcher with dependencies

PHP Build Version
Package Version
Requires react/child-process Version ^0.6.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package myvon/reactphp-file-system-watcher contains the following files

Loading the files please wait ....