PHPackages                             jedibc/decorator-stack - 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. jedibc/decorator-stack

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

jedibc/decorator-stack
======================

A simple tool for stacking decorators

v1.0.1(11y ago)24.5k1MITPHPPHP &gt;=5.4

Since Feb 16Pushed 11y ago1 watchersCompare

[ Source](https://github.com/JEDIBC/DecoratorStack)[ Packagist](https://packagist.org/packages/jedibc/decorator-stack)[ RSS](/packages/jedibc-decorator-stack/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

JEDIBC/DecoratorStack
=====================

[](#jedibcdecoratorstack)

[![Build Status](https://camo.githubusercontent.com/278191ff0d8546267721c4913ffb808b38955850f138bf77a1dafe09f4ba9417/68747470733a2f2f7472617669732d63692e6f72672f4a45444942432f4465636f7261746f72537461636b2e706e67)](https://travis-ci.org/JEDIBC/DecoratorStack)

A simple tool for stacking decorators.

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

[](#installation)

The recommended way to install the library is through [Composer](http://getcomposer.org/). Require the `jedibc/decorator-stack` package into your `composer.json` file:

```
{
    "require": {
        "jedibc/decorator-stack": "@stable"
    }
}
```

Usage
-----

[](#usage)

Currently, if you want to decorate an object, you'll have to do something like this :

```
$decoratedObject = new Foo\Bar\Decorator1(
	new Foo\Bar\Decorator2(
    	new Foo\Bar\Decorator3(
        	new ObjectToDecorate()
        ), [$someConstuctorArgument])
);
```

The more decorators you have, the more ugly your code become.

With DecoratorStack, you can simplify it :

```
$stack = (new DecoratorStack\Builder('Foo\Bar\DummyInterface'))
	->push('Foo\Bar\Decorator1')
	->push('Foo\Bar\Decorator2', [$someConstuctorArgument])
	->push('Foo\Bar\Decorator3');

$decoratedObject = $stack->resolve(new ObjectToDecorate())
```

Each decorator and the object to decorate **must** implement the `Foo\Bar\DummyInterface` (or it can be extending an abstract class).

Inspiration
-----------

[](#inspiration)

- [stackphp/builder](https://github.com/stackphp/builder)
- [swarrot/swarrot](https://github.com/swarrot/swarrot)

License
-------

[](#license)

DecoratorStack is released under the MIT License. See the bundled LICENSE file for details.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Total

2

Last Release

4144d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3600694cb928912bc7e66ec774e4154356920790a1afeea29369dba9181c2687?d=identicon)[JEDI\_BC](/maintainers/JEDI_BC)

---

Top Contributors

[![JEDIBC](https://avatars.githubusercontent.com/u/292261?v=4)](https://github.com/JEDIBC "JEDIBC (6 commits)")

---

Tags

stackdecorator

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jedibc-decorator-stack/health.svg)

```
[![Health](https://phpackages.com/badges/jedibc-decorator-stack/health.svg)](https://phpackages.com/packages/jedibc-decorator-stack)
```

###  Alternatives

[symfony/lock

Creates and manages locks, a mechanism to provide exclusive access to a shared resource

514135.1M625](/packages/symfony-lock)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[phpro/soap-client

A general purpose SoapClient library

8895.9M52](/packages/phpro-soap-client)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

562565.8k42](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

749284.3k35](/packages/civicrm-civicrm-core)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.9M203](/packages/illuminate-broadcasting)

PHPackages © 2026

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