Download the PHP package olafnorge/console-mutex without Composer

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

Laravel Console Mutex

Latest Stable Version Latest Unstable Version Total Downloads License

Prevents overlapping for Laravel console commands.

Table of contents

Requirements

Usage

  1. Install package through composer:

  2. Use olafnorge\Console\WithoutOverlapping trait:

Strategies

Overlapping can be prevented by various strategies:

Default file strategy is fine for a small applications, which are deployed on a single server. If your application is more complex and, for example, is deployed on a several nodes, then you probably would like to use some other mutex strategy.

You can change mutex strategy by specifying $mutexStrategy field:

Or by using setMutexStrategy method:

Advanced

Set custom timeout

By default mutex is checking for a running command, and if it finds such, it just exits. However, you can manually set timeout for a mutex, so it can wait for another command to finish it's execution, instead of just quitting immediately.

You can change mutex timeout by specifying $mutexTimeout field:

Or by using setMutexTimeout method:

There are three possible options for $mutexTimeout field:

Handle several commands

Sometimes it is useful to set common mutex for a several commands. You can easily achieve this by setting them the same mutex name. By default, mutex name is generated based on a command's name and arguments. To change this, just override getMutexName method in your command:

Troubleshooting

Trait included, but nothing happens?

Note, that WithoutOverlapping trait is overriding initialize method:

If your command is overriding initialize method too, then you should call initializeMutex method by yourself:

Several traits conflict?

If you're using some other cool olafnorge/console-% packages, well, then you can find yourself getting "traits conflict". For example, if you're trying to build loggable command, which is protected against overlapping:

You'll get fatal error, the "traits conflict", because both of these traits are overriding initialize method:

If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.

But don't worry, solution is very simple. Override initialize method by yourself, and initialize traits in required order:


All versions of console-mutex with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
illuminate/support Version 5.1.*|5.2.*|5.3.*|5.4.*
illuminate/console Version 5.1.*|5.2.*|5.3.*|5.4.*
arvenil/ninja-mutex Version ^0.6
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 olafnorge/console-mutex contains the following files

Loading the files please wait ....