PHPackages                             azexsoft/di - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. azexsoft/di

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

azexsoft/di
===========

Azexsoft Dependency Injection

v1.1.2(4y ago)056MITPHPPHP ^7.1|^8.0

Since Sep 4Pushed 4y ago1 watchersCompare

[ Source](https://github.com/azexsoft/di)[ Packagist](https://packagist.org/packages/azexsoft/di)[ RSS](/packages/azexsoft-di/feed)WikiDiscussions 1.x Synced today

READMEChangelogDependencies (1)Versions (8)Used By (0)

Azexsoft Dependency Injection
=============================

[](#azexsoft-dependency-injection)

[![License](https://camo.githubusercontent.com/e33f346d031a5a5b13d96e5f2538ccc083df25b1d3220639ebff7af07e25163e/68747470733a2f2f706f7365722e707567782e6f72672f617a6578736f66742f64692f6c6963656e7365)](https://packagist.org/packages/azexsoft/di)[![Latest Stable Version](https://camo.githubusercontent.com/306b3994cc3e0115514fdbdeabb6d8b180ce18d82301f2486cda16059aea55f8/68747470733a2f2f706f7365722e707567782e6f72672f617a6578736f66742f64692f76)](https://packagist.org/packages/azexsoft/di)[![Total Downloads](https://camo.githubusercontent.com/8653f48399412d13ca97fed96f51608ccd77c1e519d08df35ce8cf3955793c58/68747470733a2f2f706f7365722e707567782e6f72672f617a6578736f66742f64692f646f776e6c6f616473)](https://packagist.org/packages/azexsoft/di)

Simple [PSR-11](http://www.php-fig.org/psr/psr-11/) compatible [dependency injection](http://en.wikipedia.org/wiki/Dependency_injection) container and injector based on autowiring that is able to instantiate and configure classes resolving dependencies. Works only with classes and interfaces. Works with PHP 7.1+ and 8.0+.

Features
--------

[](#features)

- [PSR-11](http://www.php-fig.org/psr/psr-11/) compatible.
- Detects circular references.
- Supports classname, object and Closure bindings.
- Supports service providers and deferred service providers.
- Injector resolves dependencies for definitions when building class and invoke dependencies.
- Injector supports array definitions with method arguments and properties resolving dependencies.

Configure container
-------------------

[](#configure-container)

Just create container instance with an array of bindings and array of service providers.

```
// Bindings
$bindings = [
    FooInterface::class => Foo::class, // Classname binding
    Baz::class => new Baz(), // Object binding

    // Closure binding with DI resolving in Closure params
    Bar::class => fn(\Azexsoft\Di\Injector $injector) => $injector->build(
        Bar::class,
        [
            'config' => $params['barConfig'],
            'someParameter' => 123
        ]
    ),
];

// Service providers
$providers = [
    ApplicationServiceProvider::class,
    new FooServiceProvider(),
];

$container = new \Azexsoft\Di\Container($bindings, $providers);
```

Also, you can add bindings and providers after container be configurated. After rebinding old instance will be removed from container.

```
$foo = $container->get(FooInterface::class); // will be returned Foo
$container->bind(FooInterface::class, OtherFoo::class);
$otherFoo = $container->get(FooInterface::class); // will be returned OtherFoo
```

Array definitions for injector builder. Works for bind() and provide() methods.

```
$container->bind(Abstract::class, [
    '__class' => Concrete::class, // Concrete classname
    '__construct()' => [
        'simpleParam' => 123,
        'otherSimpleParam' => $params['concreteSomeParam'],
        'someObject' => new Definition(fn(Dependency $d) => $d->getSomeObject()),
    ],
    'someMethod()' => [
        'methodParam' => $params['someMethodParam'],
    ],
    'someProperty' => 321
]);
```

Instead of:

```
$container->bind(Abstract::class, function(Injector $injector, Dependency $d) use ($params) {
    $concrete = $injector->build(Concrete::class,  [
        'simpleParam' => 123,
        'otherSimpleParam' => $params['concreteSomeParam'],
        'someObject' => $d->getSomeObject(),
    ]);
    $concrete->someMethod($params['someMethodParam']);
    $concrete->someProperty = 321;
    return $concrete;
});
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Recently: every ~126 days

Total

8

Last Release

1517d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0

v1.1.1PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5d31c4515f7081f7b31c6fdd680d82415d904599bf0feb2b733925b952ced08?d=identicon)[zakharenka](/maintainers/zakharenka)

---

Top Contributors

[![zakharenka](https://avatars.githubusercontent.com/u/17183002?v=4)](https://github.com/zakharenka "zakharenka (5 commits)")

---

Tags

containerPSR-11Autowiringdependencyinjectiondiinjector

### Embed Badge

![Health badge](/badges/azexsoft-di/health.svg)

```
[![Health](https://phpackages.com/badges/azexsoft-di/health.svg)](https://phpackages.com/packages/azexsoft-di)
```

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86894.4M439](/packages/league-container)[yiisoft/di

Yii DI container

2391.4M119](/packages/yiisoft-di)[slince/di

A flexible dependency injection container

20272.1k6](/packages/slince-di)[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2860.1k2](/packages/capsule-di)[miladrahimi/phpcontainer

Dependency injection (IoC) container for PHP projects

1324.1k2](/packages/miladrahimi-phpcontainer)[devanych/di-container

Simple implementation of a PSR-11 dependency injection container

124.3k3](/packages/devanych-di-container)

PHPackages © 2026

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