PHPackages                             beaucal/beaucal-quick-union - 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. beaucal/beaucal-quick-union

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

beaucal/beaucal-quick-union
===========================

Provides union-find functionality, whether directed or shortest.

v1.0.0(11y ago)165MITPHPPHP &gt;=5.4

Since May 6Pushed 10y ago1 watchersCompare

[ Source](https://github.com/BeauCal/beaucal-quick-union)[ Packagist](https://packagist.org/packages/beaucal/beaucal-quick-union)[ Docs](https://github.com/BeauCal/beaucal-quick-union)[ RSS](/packages/beaucal-beaucal-quick-union/feed)WikiDiscussions master Synced 1mo ago

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

BeaucalQuickUnion
=================

[](#beaucalquickunion)

[![Build Status](https://camo.githubusercontent.com/34904ca8e0895dc9cd367bdb2afbdbe87585d4a297fb4dc70f67b92adf2852e9/68747470733a2f2f7472617669732d63692e6f72672f4265617543616c2f6265617563616c2d717569636b2d756e696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/BeauCal/beaucal-quick-union)

**Now with 100% code coverage.**

Provides union-find functionality, whether directed or shortest.

### Installation

[](#installation)

1. In `application.config.php`, add as follows:

```
'modules' => [..., 'BeaucalQuickUnion', ...];
```

2. Import into your database `data/beaucal_union.sql`:

```
CREATE TABLE IF NOT EXISTS `beaucal_union` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `item` varchar(255) NOT NULL UNIQUE KEY,
  `set` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `beaucal_union` ADD INDEX(`set`);
ALTER TABLE `beaucal_union` ADD FOREIGN KEY (`set`)
  REFERENCES `beaucal_union`(`item`) ON DELETE RESTRICT ON UPDATE CASCADE;
```

### To Use

[](#to-use)

```
// in controller
$union = $this->getServiceLocator()->get('BeaucalQuickUnion');

$union->union('AAA', 'BBB');
echo $union->query('AAA'); // 'AAA' or 'BBB', random/set behaviour
echo $union->query('AAA') == $union->query('BBB'); // TRUE
echo $union->query('BBB') == $union->query('ZZZ'); // FALSE

$union->union(new Order\Directed('AAA', 'ZZZ'));
echo $union->query('AAA'); // 'ZZZ'
echo $union->query('BBB') == $union->query('ZZZ'); // TRUE

// change from random/set behaviour to known/directed
// or change via beaucalquickunion.global.php: option order_class
$union->getOptions()->setOrderClass('BeaucalQuickUnion\Order\Directed');
$union->union('PPP', 'QQQ');
echo $union->query('PPP'); // 'QQQ', no longer random
```

### Separate Structures

[](#separate-structures)

If you need a separate union space, simply preface each item with a namespace, e.g. `union('JobID::123', 'JobID::456')`.

Or for complete separation, configure another union + adapter instance and change its database table.

```
$adapterOptions = $serviceLocator->get('BeaucalQuickUnion\Options\DbAdapter');
$adapterOptions->setDbTable('beaucal_union_separate');
$gateway = new TableGateway(
$adapterOptions->getDbTable(), $serviceLocator->get($adapterOptions->getDbAdapterClass())
);
$adapter = new DbAdapter($gateway, $adapterOptions);

$union = new Union($adapter, $unionOptions);
```

### Memory Adapter

[](#memory-adapter)

If you just need a short-lived instance for a single request, use the Memory adapter, as follows:

```
// in beaucalquickunion.global.php
$union = [
    'adapter_class' => 'BeaucalQuickUnion\Adapter\Memory',
// ...
]
// in controller
$union = $this->getServiceLocator()->get('BeaucalQuickUnion');

// alternatively, a shortcut factory that doesn't require config
$throttle = $this->getServiceLocator()->get('BeaucalQuickUnion_Memory');
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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 ~1 days

Total

4

Last Release

4026d ago

Major Versions

v0.3.0 → v1.0.02015-05-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/36c24140c7709b9015bdb1d58f0937b0c72801a63ae4b32cc18ba3f71a1eaa23?d=identicon)[dillchuk](/maintainers/dillchuk)

---

Top Contributors

[![dillchuk](https://avatars.githubusercontent.com/u/11740626?v=4)](https://github.com/dillchuk "dillchuk (32 commits)")

---

Tags

zf2graphunion

### Embed Badge

![Health badge](/badges/beaucal-beaucal-quick-union/health.svg)

```
[![Health](https://phpackages.com/badges/beaucal-beaucal-quick-union/health.svg)](https://phpackages.com/packages/beaucal-beaucal-quick-union)
```

###  Alternatives

[zf-commons/zfc-base

A set of genetic (abstract) classes which are commonly used across multiple modules.

1441.1M25](/packages/zf-commons-zfc-base)[akrabat/akrabat-session

A Zend Framework 2 module for configuring sessions

134.5k](/packages/akrabat-akrabat-session)

PHPackages © 2026

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