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

ActiveLibrary[Framework](/categories/framework)

descent/dependency-injection
============================

Descent Framework Dependency Injection Component

00PHP

Since Feb 17Pushed 9y ago1 watchersCompare

[ Source](https://github.com/descent-universe/dependency-injection)[ Packagist](https://packagist.org/packages/descent/dependency-injection)[ RSS](/packages/descent-dependency-injection/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

dependency-injection
====================

[](#dependency-injection)

Descent Framework Dependency Injection Container

### The dependency builder

[](#the-dependency-builder)

This component serves a general dependency builder implementation implemented as `Descent\Services\DependencyBuilder`. The dependency builder orchestrates dependencies by constructing them without configuration. Optionally provided parameters and a list of enforced parameters are priorized in the building process.

##### Building an object from a interface factory

[](#building-an-object-from-a-interface-factory)

```
use Descent\Services\{
    DependencyBuilder,
    Entities\Factory
};

$builder = new DependencyBuilder();
$factory = new Factory(
    DateTimeInterface::class,
    function(string $time, string $zone = null) {
        return new DateTime(
            $time,
            new DateTimeZone($zone ?? 'europe/berlin')
        );
    }
);

$object = $builder->build($factory, ['time' => 'now']);
```

##### Building an object from a interface

[](#building-an-object-from-a-interface)

```
use Descent\Services\{
    DependencyBuilder
};

class Foo {

}

class Bar {
    protected $foo;

    public function __constrct(Foo $foo)
    {
        $this->foo = $foo;
    }
}

$builder = new DependencyBuilder();

$object = $builder->make(Bar::class);
```

### The dependency injection container

[](#the-dependency-injection-container)

This component serves a general dependency injection container implementation implemented as `Descent\Services\DependencyInjectionContainer`. The dependency injection container allows to register services as interface concrete assignments (service) as well as interface callback assignments (factories). The dependency injection container extends the dependency builder and alters the interface resolving of the dependency builder to seek for registered interfaces first.

##### Building objects from registered services

[](#building-objects-from-registered-services)

```
use Descent\Services\{
    DependencyInjectionContainer
};

class Foo {

}

class Bar {
    protected $foo;

    public function __constrct(Foo $foo)
    {
        $this->foo = $foo;
    }
}

$container = new DependencyInjectionContainer();

$container->bind(Foo::class)->singleton();
$container->bind(Bar::class);

$object = $container->make(Bar::class);
```

##### Building objects from registered factories

[](#building-objects-from-registered-factories)

```
use Descent\Services\{
    DependencyInjectionContainer
};

class Foo {

}

class Bar {
    protected $foo;
    protected $bar;

    public function __constrct(Foo $foo, Foo $bar)
    {
        $this->foo = $foo;
        $this->bar = $bar;
    }
}

$container = new DependencyInjectionContainer();

$container->bind(Foo::class)->singleton();
$container->factory(
    Bar::class,
    function(Foo $foo, Foo $bar = null) {
        return new Bar($foo, $bar ?? $foo);
    }
)->enforceParameters('bar');

$object = $container->make(Bar::class);
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7180946?v=4)[Nihylum Development Workspace](/maintainers/nihylum)[@Nihylum](https://github.com/Nihylum)

---

Top Contributors

[![nhlm](https://avatars.githubusercontent.com/u/23406211?v=4)](https://github.com/nhlm "nhlm (10 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k38.6M290](/packages/laravel-dusk)[nineinchnick/edatatables

Grid widget for the Yii Framework, wrapper for the DataTables jQuery plugin

173.2k](/packages/nineinchnick-edatatables)[link-cloud/fast-hyperf

LinkCloud Fast Hyperf

241.2k1](/packages/link-cloud-fast-hyperf)

PHPackages © 2026

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