PHPackages                             fliglio/borg - 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. fliglio/borg

ActiveLibrary

fliglio/borg
============

Fliglio Borg

2.3.4(5y ago)011.9k[4 issues](https://github.com/fliglio/borg/issues)GPL-3.0+PHPPHP &gt;=5.6CI failing

Since Dec 24Pushed 5y ago7 watchersCompare

[ Source](https://github.com/fliglio/borg)[ Packagist](https://packagist.org/packages/fliglio/borg)[ RSS](/packages/fliglio-borg/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (14)Versions (21)Used By (0)

[![Build Status](https://camo.githubusercontent.com/30475c8eaf9ce78b0887f516bee3bbceb27c571d61c09120c017a502a7aaa49b/68747470733a2f2f7472617669732d63692e6f72672f666c69676c696f2f626f72672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/fliglio/borg)[![Latest Stable Version](https://camo.githubusercontent.com/049586b9c2ff730ef8c5cd48cc2009d0ed9cf70b67082254972bc7d03a5f6971/68747470733a2f2f706f7365722e707567782e6f72672f666c69676c696f2f626f72672f762f737461626c652e737667)](https://packagist.org/packages/fliglio/borg)

Fliglio.Borg
============

[](#fliglioborg)

`Fliglio\Borg` is an implementation of goroutines (made popular by golang) to provide a distributed parallel concurrency framework for PHP.

If you're a member of the Borg Collective, you don't do anything by yourself. You don't make decisions by yourself, you don't solve problems by yourself, and you certainly don't do work by yourself - you distribute the load across the collective!

And now you can too.

### TODO / Caveats

[](#todo--caveats)

#### Next

[](#next)

- support sending `null` to Chans and Collective Routines
    - make match typical php behavior ([see here](http://artur.ejsmont.org/blog/content/php-typehints-causing-errors-when-null-gets-passed-in))
- add `sync` concept
    - have collective routine dispatch return an exit `Chan`
    - each collective routine sends `null` of an exception on this `Chan`
    - the main process calls `sync` passing in an array of exit chans; this blocks until all have returned a value. If the value is an exception, it will be rethrown.

#### Other

[](#other)

- Collective Routines must be exact types. You can't hint your method with an interface and pass in an implementation (the hint is used to unmarshal the argument.)
- Only Collective Routines are multi-datacenter aware. Chans can only be used in your local datacenter.
- Though Chan ordering is always guaranteed, ChanReader introduces some weirdness where messages published to different Chans might be read out of order (see below)
- `Chan::get` is implemented by polling `basic_get`. It would be nice to iteratively use `basic_consume`

#### ChanReader

[](#chanreader)

There is a race condition with ChanReaders where order between channels can't be guaranteed. In the following example, even though `$ex` is added to after all numbers have been added to `$ch`, The `$ex` value might arraive in the `ChanReader` first. In this situation, consider sending a `null` to `$ch` to signal that the work is done.

```
public function generateNumbers(GetParam $limit) {
	$ch = $this->mkChan();
	$ex = $this->mkChan();

	$this->coll()->gen($ch, $ex, $limit->get());

	$nums = [];

	$r = $this->coll()->mkChanReader([$ch, $ex]);
	while (true) {
		list($id, $val) = $r->get();
		switch ($id) {
		case $ch->getId():
			$nums[] = $val;
			break;
		case $ex->getId():
			return $nums;
		}
	}
}
public function gen(Chan $ch, Chan $ex, $limit) {
	for ($i = 0; $i add($i);
	}

	// sleep for a second to avoid the possibility that the $ex value is read before $ch's last value
	sleep(1);

	$ex->add(true);
}

```

local shakespeare
=================

[](#local-shakespeare)

```
$this->urlsd = [
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-alls-11.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-antony-23.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-as-12.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-comedy-7.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-coriolanus-24.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-cymbeline-17.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-first-51.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-hamlet-25.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-julius-26.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-king-45.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-life-54.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-life-55.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-life-56.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-lovers-62.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-loves-8.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-macbeth-46.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-measure-13.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-merchant-5.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-merry-15.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-midsummer-16.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-much-3.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-othello-47.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-pericles-21.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-rape-61.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-romeo-48.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-second-52.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-sonnets-59.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-taming-2.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-tempest-4.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-third-53.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-timon-49.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-titus-50.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-tragedy-57.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-tragedy-58.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-troilus-22.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-twelfth-20.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-two-18.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-venus-60.txt',
	__DIR__ . '/../../../../shakespeare-txt/shakespeare-winters-19.txt',
	__DIR__ . '/../../../../shakespeare-txt/sonnets.txt',
];

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 93.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 ~96 days

Recently: every ~11 days

Total

14

Last Release

2156d ago

PHP version history (2 changes)2.1.0PHP &gt;=5.4

2.3.0PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b66bcc04aae61ef3cbc3770b8eb7b8bd5dfb6706e5f71b833c194e429b975fb?d=identicon)[benschw](/maintainers/benschw)

---

Top Contributors

[![benschw](https://avatars.githubusercontent.com/u/98852?v=4)](https://github.com/benschw "benschw (104 commits)")[![philipwhitt](https://avatars.githubusercontent.com/u/5478888?v=4)](https://github.com/philipwhitt "philipwhitt (2 commits)")[![sven7777](https://avatars.githubusercontent.com/u/5385519?v=4)](https://github.com/sven7777 "sven7777 (2 commits)")[![KokeClassic](https://avatars.githubusercontent.com/u/13053819?v=4)](https://github.com/KokeClassic "KokeClassic (1 commits)")[![Mehokm](https://avatars.githubusercontent.com/u/1044781?v=4)](https://github.com/Mehokm "Mehokm (1 commits)")[![oh4real](https://avatars.githubusercontent.com/u/152303?v=4)](https://github.com/oh4real "oh4real (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fliglio-borg/health.svg)

```
[![Health](https://phpackages.com/badges/fliglio-borg/health.svg)](https://phpackages.com/packages/fliglio-borg)
```

###  Alternatives

[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2752.3M7](/packages/bschmitt-laravel-amqp)[wheelpros/fitment-platform-api

Magento 2 (Open Source)

12.1k1.2k](/packages/wheelpros-fitment-platform-api)[jwage/phpamqplib-messenger

Symfony messenger transport for the php-amqplib/php-amqplib library.

84149.7k1](/packages/jwage-phpamqplib-messenger)[convenia/pigeon

3233.0k](/packages/convenia-pigeon)[utopia-php/queue

A powerful task queue.

11183.5k3](/packages/utopia-php-queue)

PHPackages © 2026

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