PHPackages                             phlllpe/chain - 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. phlllpe/chain

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

phlllpe/chain
=============

Lib to create Chain of Responsibility

v1.0.0(4y ago)114MITPHPPHP &gt;=7.4

Since Dec 27Pushed 4y ago1 watchersCompare

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

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

CHAIN OF RESPONSABILITY
=======================

[](#chain-of-responsability)

---

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2fa2e88016e984543e12a195e12a8949d8ffb09cd9cd3e9a1b8813f24fed47c8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70686c6c6c70652f636861696e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/phlllpe/chain/?branch=main)[![Code Coverage](https://camo.githubusercontent.com/318b351fb3ac2e3fabc6752bb05abd2f201992d6203437b05979a617fa856710/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70686c6c6c70652f636861696e2f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/phlllpe/chain/?branch=main)[![Build Status](https://camo.githubusercontent.com/81de8047ac3932aa1a61eb1dea42040a7646c9ef6a1e90fe24e7fd87b0486a93/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70686c6c6c70652f636861696e2f6261646765732f6275696c642e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/phlllpe/chain/build-status/main)[![Code Intelligence Status](https://camo.githubusercontent.com/4fdea58c7e0373ad5278e23250292f05a62b4935821a83bd5798221d572cfd05/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f70686c6c6c70652f636861696e2f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d61696e)](https://scrutinizer-ci.com/code-intelligence)

---

HOW TO INSTALL
--------------

[](#how-to-install)

```
composer req phlllpe/chain
```

USAGE
-----

[](#usage)

- Create a Handlers, example:

```
namespace Any\Handler;

use Chain\AbstractHandler;
use Chain\ContextInterface;

class MyHandler extends AbstractHandler
{
    public function handle(ContextInterface $context)
    {
        // TO DO ANY ACTION HERE, WITH ANY TEST
        if ($context->get('any') == 'HERE') {
            $context->set('myClass', static::class);
        }

        return parent::handle($context);
    }
}
```

- Define a sequence to setup/analyse your context with your handlers;

```
namespace Any\Service;

use Chain\Context;
use Any\Handler\{
    MainHandler,
    AddressHandler,
    BudgetHandler,
    FamilyHandler
};

class MyService
{

    public function __invoke()
    {
        $context = new Context();
        $context->set('name', 'Philipe Fernandes');

        $mainHandler = new MainHandler();
        $addressHandler = new AddressHandler();
        $budgetHandler = new BudgetHandler();
        $familyHandler = new FamilyHandler();

        $mainHandler
            ->setNext($addressHandler)
            ->setNext($budgetHandler)
            ->setNext($familyHandler)

        (new Runner())->run($mainHandler, $context);
    }
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1601d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7872406?v=4)[Philipe Fernandes](/maintainers/phlllpe)[@phlllpe](https://github.com/phlllpe)

---

Top Contributors

[![phlllpe](https://avatars.githubusercontent.com/u/7872406?v=4)](https://github.com/phlllpe "phlllpe (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phlllpe-chain/health.svg)

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

###  Alternatives

[hanson/rainbow

4710.4k](/packages/hanson-rainbow)

PHPackages © 2026

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