PHPackages                             draw/dependency-injection - 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. [Framework](/categories/framework)
4. /
5. draw/dependency-injection

ActiveLibrary[Framework](/categories/framework)

draw/dependency-injection
=========================

Dependency injection addons to Symfony

0.39.2(2mo ago)015.1k↑97.4%16MITPHPPHP &gt;=8.5

Since Jun 30Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (42)Used By (16)

Dependency Injection
====================

[](#dependency-injection)

This package provides addons to the Symfony Dependency Injection component.

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

[](#installation)

```
composer require draw/dependency-injection

```

Integration
-----------

[](#integration)

The `Draw\Component\DependencyInjection\Integration` namespace contains classes that can be used to easily integrate subcomponents into a main bundle.

An example of this is all the draw components that are integrated into the `DrawFrameworkExtraBundle`.

When creating the main bundle extension you can use the `IntegrationTrait` to easily integrate all the subcomponents.

```
namespace Example\Bundle\MyBundle\DependencyInjection;

use Draw\Component\DependencyInjection\IntegrationTrait;
use Example\Component\MyComponent\DependencyInjection\MyCompnentIntegration;
use Example\Component\MyOtherComponent\DependencyInjection\MyOtherComponentIntegration;

class ExampleMyBundle extends Bundle
{
    use ExtendableExtensionTrait;

    public function __construct()
    {
        $this->registerDefaultIntegrations();
    }

    private function provideExtensionClasses(): array
    {
        return [
            MyCompnentIntegration::class,
        ];
    }

    public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
    {
        return new Configuration($this->integrations);
    }

    public function load(array $configs, ContainerBuilder $container): void
    {
        $config = $this->loadIntegrations($configs, $container);

        // Do your bundle specific configuration here
    }

    public function prepend(ContainerBuilder $container): void
    {
        $this->prependIntegrations($container, 'example_my_bundle');
    }
}
```

**registerDefaultIntegrations**

The `registerDefaultIntegrations` method will automatically register all the integrations that are in the `provideExtensionClasses` method.

It will check if the class exists and if it does it will create a new instance of it and add it to the `integrations` property.

That way you can define the integration classes in the specific component, and it will automatically be integrated into the main bundle if your component is installed.

**loadIntegrations**

The `loadIntegrations` method will call the `load` method on all the integrations that are registered.

It will automatically pass the configuration to the existing configuration only if they are `enabled`.

**prependIntegrations**

The `prependIntegrations` method will call the `prepend` method on all the integrations that are registered.

It will check if the configuration is `enabled` and if it is it will call the `prepend` method.

### Configuration

[](#configuration)

Here is an example of configuration base on the example above.

```
example_my_bundle:
    my_component:
        enabled: true
        my_component_configuration: true
    my_other_component:
        enabled: false
```

This example will enable the `MyComponentIntegration` and disable the `MyOtherComponentIntegration`.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 97.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 ~15 days

Recently: every ~26 days

Total

41

Last Release

77d ago

PHP version history (3 changes)0.10.38PHP &gt;=8.1

0.10.47PHP &gt;=8.2

0.39.0PHP &gt;=8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bb9496b48abc2bfd37ebafa9cc4b3b1307a369ad27f6514943408d9b5ff18a5?d=identicon)[mpoiriert](/maintainers/mpoiriert)

---

Top Contributors

[![mpoiriert](https://avatars.githubusercontent.com/u/4175616?v=4)](https://github.com/mpoiriert "mpoiriert (36 commits)")[![DumitracheAdrian](https://avatars.githubusercontent.com/u/12441524?v=4)](https://github.com/DumitracheAdrian "DumitracheAdrian (1 commits)")

---

Tags

symfonycomponentdraw

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[league/tactician-bundle

Bundle to integrate Tactician with Symfony projects

24810.1M18](/packages/league-tactician-bundle)[kafkiansky/symfony-middleware

PSR-15 Middleware for symfony.

7959.6k](/packages/kafkiansky-symfony-middleware)[gnugat/micro-framework-bundle

Symfony Micro Framework Bundle

3710.6k1](/packages/gnugat-micro-framework-bundle)[phpmentors/workflower-bundle

A Symfony bundle for Workflower

2415.2k](/packages/phpmentors-workflower-bundle)[visithor/visithor-bundle

Visithor Bundle for Symfony

1620.2k3](/packages/visithor-visithor-bundle)

PHPackages © 2026

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