PHPackages                             madlab/multi-server-scheduling - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. madlab/multi-server-scheduling

ActiveLibrary[CLI &amp; Console](/categories/cli)

madlab/multi-server-scheduling
==============================

This package extends Laravel's native Command Event class to add functionality that prevents events from overlapping when ran in multi server environments. This is achieved using Laravel Cache

v1.1.0(9y ago)718.6kMITPHPPHP &gt;=5.5.9

Since Sep 28Pushed 9y ago4 watchersCompare

[ Source](https://github.com/MadLab/MultiServerScheduling)[ Packagist](https://packagist.org/packages/madlab/multi-server-scheduling)[ RSS](/packages/madlab-multi-server-scheduling/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Multi Server Scheduling
=======================

[](#multi-server-scheduling)

This package extends Laravel's native task scheduling to include the ability to lock events and block them from overlapping when in a multi webserver environment.

It works similarly to Laravel's `withoutOverlapping` feature, except the lockfile is written to Cache as opposed to the local filesystem, 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. We also automatically expire any locks after 1 hour.

You may also enable logging to Laravel's logfile, so that you can ensure things are working correctly.

Installation
------------

[](#installation)

```
$ composer require madlab/multi-server-scheduling

```

The new scheduler uses Laravel's cache to track which server is currently executing an event. You must make sure you have configured a cache driver that is distributed and accessible by all servers (like memcache or redis).

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

```
use Illuminate\Contracts\Cache\Repository as Cache;
use madlab\MultiServerScheduling\Schedule as MultiServerSchedule;

/**
 * Define the application's command schedule.
 *
 * @return void
 */
protected function defineConsoleSchedule()
{
	$this->app->instance(
		Schedule::class, $schedule = new MultiServerSchedule(
			$this->app[Cache::class],
			MultiServerSchedule::LOG_LEVEL_ABANDONED
		)
	);

    $this->schedule($schedule);
}
```

Usage
-----

[](#usage)

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

```
$schedule->command('inspire')
    ->daily()
    ->withoutOverlappingCache();
```

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

Logging
-------

[](#logging)

When intitializing the Scheduler in app\\Console\\Kernal.php, you may pass in 3 different logging levels:

- LOG\_LEVEL\_NONE: logging is disabled
- LOG\_LEVEL\_ABANDONED: a log will be written anytime a server tries to execute a task that has already been running for 10+ minutes
- LOG\_LEVEL\_VERBOSE: most detailed, will log anytime a lock is attempted, obtained, or released

Support
-------

[](#support)

This was made by Nick Ashley at [MadLab, LLC](http://www.madlab.com) and if you need paid support you can contact us at MadLab.com.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Total

4

Last Release

3432d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/449016?v=4)[Nick Ashley](/maintainers/nickashley)[@nickashley](https://github.com/nickashley)

---

Top Contributors

[![nickashley](https://avatars.githubusercontent.com/u/449016?v=4)](https://github.com/nickashley "nickashley (12 commits)")[![benswinburne](https://avatars.githubusercontent.com/u/1208977?v=4)](https://github.com/benswinburne "benswinburne (1 commits)")[![robertgentel](https://avatars.githubusercontent.com/u/448606?v=4)](https://github.com/robertgentel "robertgentel (1 commits)")

---

Tags

schedulerlaravelload balancingMulti-Server

### Embed Badge

![Health badge](/badges/madlab-multi-server-scheduling/health.svg)

```
[![Health](https://phpackages.com/badges/madlab-multi-server-scheduling/health.svg)](https://phpackages.com/packages/madlab-multi-server-scheduling)
```

###  Alternatives

[unopim/unopim

UnoPim Laravel PIM

10.5k2.2k](/packages/unopim-unopim)[ibex/crud-generator

Laravel CRUD Generator

701247.2k](/packages/ibex-crud-generator)[ronasit/laravel-entity-generator

Provided console command for generating entities.

2052.5k](/packages/ronasit-laravel-entity-generator)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21313.7k3](/packages/ecotone-laravel)[a-bashtannik/fasti

Laravel task scheduler with calendar-based management.

134.2k](/packages/a-bashtannik-fasti)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
