PHPackages                             maba/dependency-injection-extra - 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. maba/dependency-injection-extra

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

maba/dependency-injection-extra
===============================

1.0.3(6y ago)6916.7k—1.4%45MITPHPPHP &gt;=7.0CI failing

Since Jul 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mariusbalcytis/dependency-injection-extra)[ Packagist](https://packagist.org/packages/maba/dependency-injection-extra)[ RSS](/packages/maba-dependency-injection-extra/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (8)Used By (5)

Extra for Symfony Dependency Injection Component
================================================

[](#extra-for-symfony-dependency-injection-component)

Deprecated
----------

[](#deprecated)

Please use [paysera/lib-dependency-injection](https://github.com/paysera/lib-dependency-injection) which provides more features than this library.

What's that?
------------

[](#whats-that)

Extra features for easier integration with Symfony Dependency Injection component.

Currently contains only compiler passes for registering tagged services with some another service - no need to write custom class in each and every case.

### `AddTaggedCompilerPass`

[](#addtaggedcompilerpass)

To register tagged services to some other service. Optionally passes attributes of the tag, too.

```
class SomeBundle extends Bundle
{
    public function build(ContainerBuilder $container)
    {
        $container->addCompilerPass(new AddTaggedCompilerPass(
            'some_bundle.registry',
            'my_provider',
            'addProvider',
            array(      // this parameter is optional and defines attributes to pass from tag
                'name',                 // required attribute
                'theme' => 'default',   // optional attribute
            )
        ));
    }
}
```

```
class Registry
{
    // first - tagged service. Others (optional) in the order as they come in the attributes array
    public function addProvider(ProviderInterface $provider, $name, $theme)
    {
        $this->providers[$name] = $provider;    // or whatever
    }
}
```

```

```

### `AddTaggedIdCompilerPass`

[](#addtaggedidcompilerpass)

Same, but first parameter to the method is not the service itself, but it's ID.

Gives some laziness if there are many tagged services and you don't use them all quite often.

You should probably stick to using lazy services, though.

### `AddTaggedByPriorityCompilerPass`

[](#addtaggedbyprioritycompilerpass)

Same as `AddTaggedCompilerPass`, but calls the method in the order defined in the `priority` attribute.

Attribute to use can be changed with `$compilerPass->setPriorityAttribute('some_other')`.

Lower the priority, earlier the call.

If priority is not provided, defaults to `0`.

```

```

Resolves to:

```
$registry->addProvider($niceProvider, 'nice', 'not a default one'); // priority -1 - smallest
$registry->addProvider($anotherProvider, 'another', 'default');     // priority defaults to 0
$registry->addProvider($awesomeProvider, 'awesome', 'default');     // priority is over 9000
```

### Restrictions

[](#restrictions)

Does not work well with several same tags on single service. Example:

```

```

Installing
----------

[](#installing)

```
composer require maba/dependency-injection-extra

```

Running tests
-------------

[](#running-tests)

[![Travis status](https://camo.githubusercontent.com/2f15eda554419ddd30a2101ca75f0bb53978e8d83291e970d42049f169f88f9a/68747470733a2f2f7472617669732d63692e6f72672f6d617269757362616c63797469732f646570656e64656e63792d696e6a656374696f6e2d65787472612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mariusbalcytis/dependency-injection-extra)[![Coverage Status](https://camo.githubusercontent.com/6192d694b2b2133ce358fdc7b85d976243ca7a0ea2bca880e501213ec8901172/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6d617269757362616c63797469732f646570656e64656e63792d696e6a656374696f6e2d65787472612f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/mariusbalcytis/dependency-injection-extra?branch=master)

```
composer update
vendor/bin/phpunit

```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% 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 ~275 days

Recently: every ~200 days

Total

7

Last Release

2297d ago

Major Versions

0.1.2 → 1.0.02017-11-22

PHP version history (4 changes)0.1.0PHP &gt;=5.3.2

0.1.2PHP ^5.3.2 || &gt;=7.0 &lt;7.3

1.0.1PHP ^5.3.2 || &gt;=7.0 &lt;7.4

1.0.2PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e131c9aa5f5a4fc3cc2f5e01b377ef33bbc3468acc95ff890fc6e8353d9cf67?d=identicon)[mariusbalcytis](/maintainers/mariusbalcytis)

---

Top Contributors

[![mariusbalcytis](https://avatars.githubusercontent.com/u/1590072?v=4)](https://github.com/mariusbalcytis "mariusbalcytis (12 commits)")[![DamienHarper](https://avatars.githubusercontent.com/u/2448660?v=4)](https://github.com/DamienHarper "DamienHarper (1 commits)")

---

Tags

dependency-injectiondicompiler pass

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maba-dependency-injection-extra/health.svg)

```
[![Health](https://phpackages.com/badges/maba-dependency-injection-extra/health.svg)](https://phpackages.com/packages/maba-dependency-injection-extra)
```

###  Alternatives

[level-2/dice

A minimalist Dependency injection container (DIC) for PHP. Please note: 3.0+ is only compatible with PHP 7.0. The 2.0 branch is compatbile with PHP 5.6.

437730.3k17](/packages/level-2-dice)[x-wp/di

The dependency injection container for WordPress

301.1k10](/packages/x-wp-di)

PHPackages © 2026

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