Download the PHP package jdavidbakr/multi-server-event without Composer

On this page you can find all versions of the php package jdavidbakr/multi-server-event. 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 multi-server-event

Multi Server Event

Latest Version on Packagist Total Downloads

This package extends Laravel's native Event class to include the ability to block events from occurring aross multiple servers, as would be the case if you have a laravel instance behind a load balancer in an auto-scaling situation.

It uses a database table to track the currently running process, and each server generates a unique key to lock the command. In order to prevent a condition where a short-running command's lock doesn't last long enough, we are implementing a minimum 10 second break between the completion of the command and its next execution time, so if a command runs every minute but takes between 50 and 59 seconds to complete, the next command will be delayed one more minute.

NOTE: Laravel 5.6 now contains a function onOneServer() that solves the issue that this package was built to fix. Therefore, it is recommended that you use the core function instead of this package.

For Laravel < 5.4, please use version 1.X

Upgrading from version 1.X

If upgrading from version 1.X, please note the change in the defineConsoleSchedule() command in app\Console\Kernel.php.

Installation

The new event structure uses a database table to track which server is currently executing an event. You must create the database table using the provided migration. To do this, add the following to the $commands array in \App\Console\Kernel.php:

then perform the migration

Now we want to change the default schedule IoC to use this alternate one. In app\Console\Kernel.php add the following function:

Usage

When composing your schedule, simply add "withoutOverlappingMultiServer()" to the command, i.e.

This will prevent multiple servers from executing the same event at the same time.

When composing your schedule, you can also ensure that cron is not stuck, simply add "ensureFinishedMultiServer()" to the command, i.e.

This will prevent from stuck commands during lost connection or deployment. Note, choose time to be enough to mark as "stuck", fox example, long running command should have bigger tolerance time. You can track such events how ofter it happens by binding listeners on EnsureCleanUpExecuted event

Testing


All versions of multi-server-event with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.9
laravel/framework Version >=5.4.26 <5.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 jdavidbakr/multi-server-event contains the following files

Loading the files please wait ....