PHPackages                             php-lrpm/php-lrpm-cluster - 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. php-lrpm/php-lrpm-cluster

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

php-lrpm/php-lrpm-cluster
=========================

PHP Long Running Process Manager Cluster

v1.0.0(2y ago)07.7k↓33.3%BSD-3-ClausePHPPHP &gt;=7.1

Since Dec 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/vrza/php-lrpm-cluster)[ Packagist](https://packagist.org/packages/php-lrpm/php-lrpm-cluster)[ RSS](/packages/php-lrpm-php-lrpm-cluster/feed)WikiDiscussions main Synced 1mo ago

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

PHP-LRPM Clustering
===================

[](#php-lrpm-clustering)

Clustering support for PHP-LRPM, including different sharding strategies.

Usage
-----

[](#usage)

You should extend the abstract `PHPLRPM\Cluster\ShardingConfigurationSource` class and implement a nullary (zero-argument) constructor which will be initializing instances of `PHPLRPM\ConfigurationSource`, `PHPLRPM\Cluster\Providers\ClusterConfigurationProvider` and `PHPLRPM\Cluster\Filters\ShardingConfigurationFilter`:

```
namespace MyNamespace;
use PHPLRPM\Cluster\ShardingConfigurationSource;

class MyLRPMWorkerShardingConfiguration extends ShardingConfigurationSource
{
    public function __construct()
    {
        //instance of PHPLRPM\ConfigurationSource
        $this->confSource = new MyLRPMWorkerConfiguration()
        //instance of PHPLRPM\Cluster\Providers\ClusterConfigurationProvider
        $this->clusterConfProvider = new EnvironmentBasedClusterConfigurationProvider();
        //instance of PHPLRPM\Cluster\Filters\ShardingConfigurationFilter
        $this->configurationFilter = new BalancedShardingConfigurationFilter();
    }
}
```

Then you may provide `MyLRPMWorkerShardingConfiguration` as a regular `ConfigurationSource` for PHP-LRPM, e.g.

```
lrpm '\MyNamespace\MyLRPMWorkerShardingConfiguration'
```

See  for more details.

Sharding Strategies
-------------------

[](#sharding-strategies)

You can either write your own `ShardingConfigurationFilter` or use one of the built-in filters.

### Balanced

[](#balanced)

Use the `BalancedShardingConfigurationFilter` when either:

- scaling involves restarting the entire cluster
- perfect load balancing is necessary

ProsConsPerfect load balancing

Potentially large number of disrupted processes when rescaling

### Rendezvous Hashing

[](#rendezvous-hashing)

Use the `RendezvousHashingShardingConfigurationFilter` when both:

- minimal worker process disruption is highly desirable
- load balancing biased towards certain nodes is tolerable

ProsConsMinimal disruption when rescaling

Biased load balancing

### Simple hashing

[](#simple-hashing)

Use the `HashingShardingConfigurationFilter` to achieve:

- decent (but not perfect) load balancing
- some (but not complete) worker process disruption when cluster is rescaled

ProsConsStrikes a balance between load balancing and disruption

Guarantees neither perfect load balancing nor minimal disruption

Cluster Configuration and Providers
-----------------------------------

[](#cluster-configuration-and-providers)

Cluster configuration parameters are

- total number of nodes in the cluster
- zero-based index of current node

You can either write your own `ClusterConfigurationProvider` or use one of the built-in providers.

### Environment-based Cluster Configuration Provider

[](#environment-based-cluster-configuration-provider)

Use the `EnvironmentBasedClusterConfigurationProvider` to load cluster configuration from environment variables `PHP_LRPM_NUMBER_OF_INSTANCES` and `PHP_LRPM_INSTANCE_NUMBER`. Default variable names can be overridden.

### File-based Cluster Configuration Provider

[](#file-based-cluster-configuration-provider)

Use the `FileBasedClusterConfigurationProvider` to load cluster configuration from a JSON configuration file, e.g.:

```
{
    "numberOfInstances": 3,
    "instanceNumber" : 2
}
```

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

[](#installation)

Assuming you have PHP Composer installed, and that the `composer` executable is in your `$PATH`:

```
composer require php-lrpm/php-lrpm-cluster
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~53 days

Total

3

Last Release

783d ago

Major Versions

v0.9.2 → v1.0.02024-03-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/b842fcccb4fa8eb90b6d6645e9fe1066b59ca01b3c38aa90c3b80a5ce07d02fe?d=identicon)[vrza](/maintainers/vrza)

---

Top Contributors

[![vrza](https://avatars.githubusercontent.com/u/1699472?v=4)](https://github.com/vrza "vrza (5 commits)")[![espectrio](https://avatars.githubusercontent.com/u/740658?v=4)](https://github.com/espectrio "espectrio (1 commits)")

---

Tags

phpprocessmanagerclusterlong-running

### Embed Badge

![Health badge](/badges/php-lrpm-php-lrpm-cluster/health.svg)

```
[![Health](https://phpackages.com/badges/php-lrpm-php-lrpm-cluster/health.svg)](https://phpackages.com/packages/php-lrpm-php-lrpm-cluster)
```

###  Alternatives

[php-lrpm/php-lrpm

PHP Long Running Process Manager

187.8k1](/packages/php-lrpm-php-lrpm)[claudiodekker/changelog-updater

A PHP package to programmatically update your changelog file.

1315.5k](/packages/claudiodekker-changelog-updater)[luka-dev/headless-task-server-php

Helper for sending requests to luka-dev/headless-task-server

109.6k](/packages/luka-dev-headless-task-server-php)

PHPackages © 2026

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