Download the PHP package allejo/resource-watcher without Composer

On this page you can find all versions of the php package allejo/resource-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 resource-watcher

Resource Watcher

A resource watcher allows you to watch a resource for any changes. This means you can watch a directory and then listen for any changes to files within that directory or to the directory itself.

This is a fork of Jason Lewis's project without Laravel dependencies and uses the Symfony Filesystem instead. This fork is intended to be used for those who do not want to add yet another Filesystem object from another project.

Installation

Use composer to add this project as a dependency.

Usage

The Resource Watcher is best used from a console. An example of a console command can be found in the watcher file. This file is commented to give you an idea of how to configure and use a resource watcher. Once you've customized the command to your liking you can run it from your console.

Any changes you make to the resource will be outputted to the console.

Quick Overview

To watch resources you first need an instance of JasonLewis\ResourceWatcher\Watcher. This class has a few dependencies (JasonLewis\ResourceWatcher\Tracker and Symfony\Component\Filesystem\Filesystem) that must also be instantiated.

Now that we have our watcher we can create a listener for a given resource.

When you watch a resource an instance of JasonLewis\ResourceWatcher\Listener is returned. With this we can now listen for certain events on a resource.

There are three events we can listen for: modify, create, and delete. The callback you give to the listener receives two parameters, the first being an implementation of JasonLewis\ResourceWatcher\Resource\ResourceInterface and the second being the absolute path to the resource.

You can use the alias methods as well.

You can also listen for any of these events. This time the callback receives a different set of parameters, the first being an instance of JasonLewis\ResourceWatcher\Event and the remaining two being the same as before.

Remember that each call to $watcher->watch() will return an instance of JasonLewis\ResourceWatcher\Listener, so be sure you attach listeners to the right one!

Once you're watching some resources and have your listeners set up you can start the watching process.

By default the watcher will poll for changes every second. You can adjust this by passing in an optional first parameter to the start method. The polling interval is given in microseconds, so 1,000,000 microseconds is 1 second. The watch will continue until such time that it's aborted from the console. To set a timeout pass in the number of microseconds before the watch will abort as the second parameter.

The start method can also be given a callback as an optional third parameter. This callback will be fired before checking for any changes to resources.

License

Resource Watcher is released under the 2-clause BSD license. See the LICENSE for more details.


All versions of resource-watcher with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
symfony/filesystem Version ^2.8|^3.0
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 allejo/resource-watcher contains the following files

Loading the files please wait ....