PHPackages                             internations/decorator-bundle - 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. internations/decorator-bundle

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

internations/decorator-bundle
=============================

Symfony bundle to handle decorators in the service containers

v1.2.0(1y ago)348.4k4MITPHPPHP ~7.1

Since Apr 2Pushed 1y ago31 watchersCompare

[ Source](https://github.com/InterNations/DecoratorBundle)[ Packagist](https://packagist.org/packages/internations/decorator-bundle)[ RSS](/packages/internations-decorator-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (7)Versions (14)Used By (0)

DecoratorBundle for Symfony
===========================

[](#decoratorbundle-for-symfony)

[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/InterNations/DecoratorBundle?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![Build Status](https://camo.githubusercontent.com/d1c2e85c9baa44356b2e0773fb26751e937e3c8012eb5bae5ed2f789e133d1ae/68747470733a2f2f7472617669732d63692e6f72672f496e7465724e6174696f6e732f4465636f7261746f7242756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/InterNations/DecoratorBundle) [![Dependency Status](https://camo.githubusercontent.com/42a87305acae09145a4f66f3de9882ea26cb975cf16c322c5f9ad0001277eba8/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3533343739633636666530643037323062353030303037632f62616467652e706e67)](https://www.versioneye.com/user/projects/53479c66fe0d0720b500007c) [![Average time to resolve an issue](https://camo.githubusercontent.com/5e03291a6deed0d0a20ba424ccae1c4369a5367366286a87208d3762d91992cc/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f7265736f6c7574696f6e2f496e7465724e6174696f6e732f4465636f7261746f7242756e646c652e737667)](http://isitmaintained.com/project/InterNations/DecoratorBundle "Average time to resolve an issue") [![Percentage of issues still open](https://camo.githubusercontent.com/72567c07e276b4fa61b6d5d2b6099022e11d99c75d8e974dda6c65ba86ba091e/687474703a2f2f697369746d61696e7461696e65642e636f6d2f62616467652f6f70656e2f496e7465724e6174696f6e732f4465636f7261746f7242756e646c652e737667)](http://isitmaintained.com/project/InterNations/DecoratorBundle "Percentage of issues still open")

Provides consistent decorator handling for the Symfony Dependency Injection Container.

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

[](#installation)

For Symfony 3.3 up to 4:

```
composer require internations/decorator-bundle
```

For Symfony &lt; 3.3:

```
composer require internations/decorator-bundle:~0
```

Usage
-----

[](#usage)

### "Decorate this"-mode

[](#decorate-this-mode)

In "decorate this"-mode you declare your decorators in the dependency at hand. A configuration example:

```

        element1
        element2

```

The configuration above will create this instance:

```
$iterator = new InfiniteIterator(
    new ArrayIterator(['element1', 'element2'])
);
```

### "Decorate other" mode

[](#decorate-other-mode)

In "decorate other"-mode you declare the subjects you are decorating in the decorator definition itself. A configuration example:

```

        element1
        element2

```

The configuration above will again create this instance:

```
$iterator = new InfiniteIterator(
    new ArrayIterator(['element1', 'element2'])
);
```

### Specifying priorities

[](#specifying-priorities)

To control the order of decoration, setting a priority flag for the decorator is supported. Priority can be between `PHP_INT_MAX` and `-PHP_INT_MAX`, the default priority is `0`.

```

```

### Using the Bundle programmatically

[](#using-the-bundle-programmatically)

In cases where you want to reuse the decoration functionality outside of the XML config, you can use the following API in your Compiler Pass. Here is an example to add decorate service `common_service` with the decorator `special_decorator` and priority `255`.

```
namespace …;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use InterNations\Bundle\DecoratorBundle\Tagger\DecorationTagger;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class MyCompilerPass implements CompilerPassInterface
{
    public function process(ContainerBuilder $container)
    {
        DecorationTagger::tag($container, 'common_service', 'special_decorator', 255);
    }
}
```

Credits
-------

[](#credits)

Based on Dovydas Bartkevicius’ idea, with a bunch of input from Max Beutel.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 81.1% 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 ~343 days

Recently: every ~603 days

Total

12

Last Release

653d ago

Major Versions

v0.9.1 → v1.0.02020-03-18

PHP version history (3 changes)v0.5.0PHP &gt;=5.6

v0.8.0PHP ~7

v0.9.1PHP ~7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/79707?v=4)[Lars Strojny](/maintainers/lstrojny)[@lstrojny](https://github.com/lstrojny)

![](https://www.gravatar.com/avatar/684ac7e28067e217fb76551137735510e86c5f69f05cd9aa6c9e6bfea1018758?d=identicon)[CMalvika](/maintainers/CMalvika)

---

Top Contributors

[![lstrojny](https://avatars.githubusercontent.com/u/79707?v=4)](https://github.com/lstrojny "lstrojny (30 commits)")[![phanan](https://avatars.githubusercontent.com/u/8056274?v=4)](https://github.com/phanan "phanan (4 commits)")[![CMalvika](https://avatars.githubusercontent.com/u/23334195?v=4)](https://github.com/CMalvika "CMalvika (2 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/internations-decorator-bundle/health.svg)

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

###  Alternatives

[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[symfony/ux-cropperjs

Cropper.js integration for Symfony

19280.3k3](/packages/symfony-ux-cropperjs)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)

PHPackages © 2026

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