PHPackages                             guglielmopepe/rings - 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. guglielmopepe/rings

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

guglielmopepe/rings
===================

A package for pipeline, macro and middleware

2.0.1(3y ago)012[1 issues](https://github.com/GuglielmoPepe/rings/issues)MITPHPPHP ^7.2.0 || ^8.0.0

Since Mar 23Pushed 3y ago1 watchersCompare

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

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Rings
=====

[](#rings)

Rings allows you to create and dispatch sequential, decorable, filterable and/or composable pipelines.

Table of Contents
-----------------

[](#table-of-contents)

- [Benefits](#benefits)
- [Features](#features)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [Support](#support)
- [Faq](#faq)
- [Contributing](#contributing)
- [Contacts](#contacts)
- [Roadmap](#roadmap)
- [Change log](#change-log)
- [License](#license)

Benefits
--------

[](#benefits)

- Be highly composable.
- Be immutable.

Features
--------

[](#features)

Rings are implemented as immutable chains. When you enqueue a new decorator, a new stage will be created with the added decorator.

You can enqueue decorators that add functionality to the pipeline. You can enqueue decorators that filter the operations to be done on data. You can enqueue decorators which add sub pipelines.

This makes pipelines easy to reuse, highly composable, and minimizes side-effects.

Prerequisites
-------------

[](#prerequisites)

- PHP 7.2.0

Yes, that's the only hard requirement.

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

[](#installation)

Use Composer

```
$ composer require guglielmopepe/rings
```

Usage
-----

[](#usage)

```
// create pipeline
$pipeline = new \Rings\Classes\Pipeline(new \SplQueue());

// add decorators:
$pipeline->addDecorator(new \Rings\Classes\Decorator(function (\Rings\Interfaces\Data $data) {echo 'Stage 1 ';return $data;}));
$pipeline->addDecorator(new \Rings\Classes\Decorator(function (\Rings\Interfaces\Data $data) {echo 'Stage 2 ';return $data;}));
$pipeline->addDecorator(new \Rings\Classes\Decorator(function (\Rings\Interfaces\Data $data) {echo 'Stage 3 ';return $data;}));

// execute command
$data = $pipeline->execute(new \Rings\Classes\Data([]));
```

Documentation
-------------

[](#documentation)

### Create pipeline like macro

[](#create-pipeline-like-macro)

```
// create pipeline
$pipeline = new \Rings\Classes\Pipeline(new \SplQueue());

// add decorators:
$pipeline->addDecorator(new \Rings\Classes\Decorator(
    function (\Rings\Interfaces\Data $data)
    {
        return new \Rings\Classes\Data(['foo' => '***' . $data['foo'] . '***']);
    })
);

$pipeline->addDecorator(new \Rings\Classes\Decorator(
    function (\Rings\Interfaces\Data $data)
    {
        return new \Rings\Classes\Data(['foo' => '___' . $data['foo'] . '___']);
    })
);

// execute command
$data = $pipeline->execute(new \Rings\Classes\Data(['foo' => 'bar']));

// print ___***bar***___
echo $data['foo'];
```

### Create pipeline with filter

[](#create-pipeline-with-filter)

```
// create pipeline
$pipeline = new \Rings\Classes\Pipeline(new \SplQueue());

// add decorators:
$pipeline->addDecorator(new \Rings\Classes\Decorator(
    function (\Rings\Interfaces\Data $data)
    {
        if (strpos($data['foo'], '***') !== FALSE)
        {
            return $data;
        }

        return new \Rings\Classes\Data(['foo' => '***' . $data['foo'] . '***']);
    })
);

$pipeline->addDecorator(new \Rings\Classes\Decorator(
    function (\Rings\Interfaces\Data $data)
    {
        if (strpos($data['foo'], '___') !== FALSE)
        {
            return $data;
        }

        return new \Rings\Classes\Data(['foo' => '___' . $data['foo'] . '___']);
    })
);

// execute command
$data = $pipeline->execute(new \Rings\Classes\Data(['foo' => 'bar']));

// print ___***bar***___
echo $data['foo'];

// execute command
$data = $pipeline->execute(new \Rings\Classes\Data(['foo' => '***bar***']));

// print ***bar***
echo $data['foo'];

// execute command
$data = $pipeline->execute(new \Rings\Classes\Data(['foo' => '___bar___']));

// print ***bar***
echo $data['foo'];
```

Support
-------

[](#support)

If you have a request, please create a GitHub [issue](https://github.com/GuglielmoPepe/rings/issues).

If you discover a security vulnerability, please send an email to Guglielmo Pepe at [info@guglielmopepe.com](mailto:%69%6e%66%6f%40%67%75%67%6c%69%65%6c%6d%6f%70%65%70%65%2e%63%6f%6d). All security vulnerabilities will be promptly addressed.

Faq
---

[](#faq)

*To do*

Contributing
------------

[](#contributing)

If you want to say **thank you** and/or support the active development of `Rings`:

1. Add a [GitHub Star](https://github.com/GuglielmoPepe/rings/stargazers) to the project.
2. Share the project on social media.
3. Write a review or tutorial on [Medium](https://medium.com/), [Dev.to](https://dev.to/) or personal blog.

Contacts
--------

[](#contacts)

If you need information please send an email to [info@guglielmopepe.com](mailto:%69%6e%66%6f%40%67%75%67%6c%69%65%6c%6d%6f%70%65%70%65%2e%63%6f%6d).

Roadmap
-------

[](#roadmap)

See the list of [open issues](https://github.com/GuglielmoPepe/rings/issues):

- [enhancement](https://github.com/GuglielmoPepe/rings/issues?q=label%3Aenhancement+is%3Aopen+sort%3Areactions-%2B1-desc)
- [bugs](https://github.com/GuglielmoPepe/rings/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Areactions-%2B1-desc)

Change log
----------

[](#change-log)

Please see [Changelog file](changelog.md) for more information on what has changed recently.

License
-------

[](#license)

Distributed under the MIT License. Please see [License File](license.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Every ~7 days

Total

2

Last Release

1138d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/78403a0da6c632ef8031333aec102230dcd8ddabbc62576fd74c5e84c6122b1b?d=identicon)[Guglielmo Pepe](/maintainers/Guglielmo%20Pepe)

---

Top Contributors

[![GuglielmoPepe](https://avatars.githubusercontent.com/u/1424836?v=4)](https://github.com/GuglielmoPepe "GuglielmoPepe (14 commits)")

---

Tags

macromiddlewaremiddleware-pipelinepipelinemiddlewaremacropipeline

### Embed Badge

![Health badge](/badges/guglielmopepe-rings/health.svg)

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

###  Alternatives

[webpatser/laravel-uuid

Laravel integration for webpatser/uuid - High-performance drop-in UUID replacements (15% faster than Ramsey). Provides Str macros, HasUuids trait, facades, and casts. RFC 4122/9562 compliant.

1.8k17.3M129](/packages/webpatser-laravel-uuid)[league/pipeline

A plug and play pipeline implementation.

1.0k16.0M74](/packages/league-pipeline)[league/uri-components

URI components manipulation library

31932.3M67](/packages/league-uri-components)[bryanjhv/slim-session

Session middleware and helper for Slim framework 4.

233961.5k16](/packages/bryanjhv-slim-session)[stolz/assets

An ultra-simple-to-use assets management library

296519.2k8](/packages/stolz-assets)[timacdonald/has-parameters

A trait that allows you to pass arguments to Laravel middleware in a more PHP'ish way.

228271.7k2](/packages/timacdonald-has-parameters)

PHPackages © 2026

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