Download the PHP package ingenerator/runsingle without Composer

On this page you can find all versions of the php package ingenerator/runsingle. 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 runsingle

ABANDONED PACKAGE

This package was abandoned on 9th March 2022 and will no longer be maintained. It was working and in use up to that date. It may be viable to fork, if still required, equally there are now various well-supported options for more generic locking packages (e.g. symfony/lock) which may be suitable if the tasks you want to run are PHP processes.

RunSingle

License Master Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version

... is a locking wrapper to ensure a command is only being run once at any given time across multiple instances. Locking is done via a database on a remote host.

Installing and building your database

Clone or download this repository, or just add it to your composer.json:

You will need php.

Initial DB configuration

For use with the standard driver, RunSingle needs access to a MySql database with a table containing these fields:

Create a file named 'run_single_config.php' in your project root on each instance. This file should return a LockDriver. You can return the standard database driver by passing the credentials to the DbDriverFactory, e.g.:

Running tasks

Using the standard driver with the wrapper script provided:

Parameters:

value is the identifier for the lock. Choose a unique, ideally short yet telling title (it has to be the same across all instances).

The amount of time in seconds the lock will be granted. It has to be bigger than the worst expected (longest) runtime of the command. A good rule of thumb is to set this to the longest interval you can afford between running the command. This strategy also serves to maximise confidence in the command really having completed.

The command to be run. Make sure there is a space ON BOTH SIDES OF THE DOUBLE DASH preceding the command, otherwise the wrapper cannot safely distinguish your command from its own arguments. Command arguments will be automatically escaped, so simply type the command after the " -- " as you would do on the shell.

Optional parameters:

Add this to have RunSingle not automatically garbage collect stale entries from the lock storage. This will usually make sense in highly concurrent setups. Disable the garbage collection on all instances BUT ONE. Having --no-garbage-collect on ALL instances means the lock will never be cleared.

Command output ...

is printed to STDOUT/STDERR as the actual script execution is done via system().

Using the LockDriver in your own classes

Roll your own driver

In order to use another storage for the lock (different database system, memcached, even file system), RunSingle will need to be passed an alternate driver implementing the LockDriver interface.

Use run_single_config.php to return an instance of your driver class (a factory is a handy way to do that but by no means mandatory).


All versions of runsingle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
psr/log Version ~1.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 ingenerator/runsingle contains the following files

Loading the files please wait ....