PHPackages                             rkr/service-dispatcher - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rkr/service-dispatcher

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rkr/service-dispatcher
======================

0.3.11(2mo ago)21.7k↓50%1MITPHPPHP &gt;= 8.1

Since May 12Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/rkrx/php-service-dispatcher)[ Packagist](https://packagist.org/packages/rkr/service-dispatcher)[ RSS](/packages/rkr-service-dispatcher/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (37)Used By (0)

php-service-dispatcher
======================

[](#php-service-dispatcher)

[![Build Status](https://camo.githubusercontent.com/f8f4741fac34021ab7e04a22ebc987dd2f88633f8a654cea827001b68d0dae78/68747470733a2f2f7472617669732d63692e6f72672f726b72782f7068702d736572766963652d646973706174636865722e737667)](https://travis-ci.org/rkrx/php-service-dispatcher)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bda3bb8d040b810692917bb62279e652147a211a8918dcfffe94d522bafebd58/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726b72782f7068702d736572766963652d646973706174636865722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rkrx/php-service-dispatcher/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/77a0799b4ac9da94a16c903d1d596ffeb701410f3898d54d8dea1a2ec8a66393/68747470733a2f2f706f7365722e707567782e6f72672f726b722f736572766963652d646973706174636865722f762f737461626c65)](https://packagist.org/packages/rkr/service-dispatcher)[![License](https://camo.githubusercontent.com/ae22a063687da43ce01ec840915d1c2d8edc2ab724eed154832e15824e797917/68747470733a2f2f706f7365722e707567782e6f72672f726b722f736572766963652d646973706174636865722f6c6963656e7365)](https://packagist.org/packages/rkr/service-dispatcher)

Common usage using SQLite
-------------------------

[](#common-usage-using-sqlite)

A simple service dispatcher for shell scripts. The intent is to run a php-cli script every minute and let the script decide, what to run at what time...

```
use Kir\Services\Cmd\Dispatcher\Dispatcher;

require __DIR__ . '/vendor/autoload.php';

use Kir\Services\Cmd\Dispatcher\ServiceDispatcherBuilder;

$dispatcher = ServiceDispatcherBuilder::withSQLite(__DIR__.'/services.db')->build();

$dispatcher->register('service1', Dispatcher::ONE_HOUR, function () {
	// Do something
	throw new Exception();
});

$dispatcher->register('service2', Dispatcher::ONE_HOUR * 3, function () {
	// Do something
});

$dispatcher->run();
```

The example above show the simplest usage of the service dispatcher. Two services get registered. "Service1" and "Service2". If one service throws an exception, the whole execution stops. Next time, the failed service starts at the end of the queue. If a service was successfully executed, the timeout schedules the service in this case to 1 hour (3600 seconds) in the future.

MySQL-Specific settings:
------------------------

[](#mysql-specific-settings)

```
use Kir\Services\Cmd\Dispatcher\ServiceDispatcherBuilder;

require __DIR__ . '/vendor/autoload.php';

/* ...  */

$dispatcher = ServiceDispatcherBuilder::withMySQL($pdo)
->useLocking(true)
->setLockPrefix('my-app:')
->build();

$dispatcher->register(/*...*/);

/* ...  */
```

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance85

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~123 days

Recently: every ~319 days

Total

36

Last Release

79d ago

PHP version history (5 changes)0.0.1PHP &gt;= 5.4

0.0.3.1PHP &gt;= 5.3

0.2.0PHP &gt;= 7.0

0.3PHP &gt;= 7.1

0.3.10PHP &gt;= 8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f83d7e57a4bf3f1309680dbfbbf2d022f0ee6dae64a4b3bdfbed1226f2f6bef?d=identicon)[rkr](/maintainers/rkr)

---

Top Contributors

[![rkrx](https://avatars.githubusercontent.com/u/5672982?v=4)](https://github.com/rkrx "rkrx (80 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rkr-service-dispatcher/health.svg)

```
[![Health](https://phpackages.com/badges/rkr-service-dispatcher/health.svg)](https://phpackages.com/packages/rkr-service-dispatcher)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[j0k3r/php-readability

Automatic article extraction from HTML

186808.8k6](/packages/j0k3r-php-readability)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)

PHPackages © 2026

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