PHPackages                             amylian/yii2-amylian-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. [Framework](/categories/framework)
4. /
5. amylian/yii2-amylian-di

ActiveYii2-extension[Framework](/categories/framework)

amylian/yii2-amylian-di
=======================

ATTENTION: EXPERIMENTAL! Dependency Injection Utilities for YII2

03PHP

Since Apr 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/amylian/yii2-amylian-di)[ Packagist](https://packagist.org/packages/amylian/yii2-amylian-di)[ RSS](/packages/amylian-yii2-amylian-di/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

amylian/yii2-amylian-di
=======================

[](#amylianyii2-amylian-di)

[![Latest Stable Version](https://camo.githubusercontent.com/2cb30736707a73071e9bc02f68f78fe89b6863112a565d41a8f9ba9d1a39801d/68747470733a2f2f706f7365722e707567782e6f72672f616d796c69616e2f796969322d616d796c69616e2d64692f762f737461626c65)](https://packagist.org/packages/amylian/yii2-amylian-di)[![License](https://camo.githubusercontent.com/274b98fa88e7d549d8516e1936d7e7fa356f893905f6aa060885baebf3fe03dc/68747470733a2f2f706f7365722e707567782e6f72672f616d796c69616e2f796969322d616d796c69616e2d64692f6c6963656e7365)](https://packagist.org/packages/amylian/yii2-amylian-di)\[[![Build Status (master)](https://camo.githubusercontent.com/73c3b6c7b7180fb09ab62e5c15035b95a210520a434696e747742178d4b73112/68747470733a2f2f7472617669732d63692e6f72672f616d796c69616e2f796969322d616d796c69616e2d64692e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/73c3b6c7b7180fb09ab62e5c15035b95a210520a434696e747742178d4b73112/68747470733a2f2f7472617669732d63692e6f72672f616d796c69616e2f796969322d616d796c69616e2d64692e7376673f6272616e63683d6d6173746572)\]

\[Master\]\[Master\]\[2.7\]\[2.7\]\[2.6\]\[2.6\]\[2.5\]\[2.5\]\[!\[Build status\]\[Master image\]\]\[Master\]\[!\[Build status\]\[2.7 image\]\]\[2.7\]\[!\[Build status\]\[2.6 image\]\]\[2.6\]\[!\[Build status\]\[2.5 image\]\]\[2.5\]\[!\[Coverage Status\]\[Master coverage image\]\]\[Master coverage\]\[!\[Coverage Status\]\[2.7 coverage image\]\]\[2.7 coverage\]\[!\[Coverage Status\]\[2.6 coverage image\]\]\[2.6 coverage\]\[!\[Coverage Status\]\[2.5 coverage image\]\]\[2.5 coverage\]**Extended Dependency Injection Container for Yii2**

Features
--------

[](#features)

Provides an extended implementation of an Dependency Injection Container for the Yii2 Framework

The following features are added to the standard implementation:

- *Named Parameters:* Constructor parameters do not need to be specified by order or index-position, but constructor parameter names can be used optionally.
- *Setter-Calls:* It's possible to specify setter-calls in the configuration array using the format `methodName()`. The value can be a reference (Instance or ReferenceInterface), but *must* be specified in an array.
- *ReferenceInterface:* Additionally to the standard Instance object, a `ReferenceInterface` is defined which is resolved upon object creation. This component already contains various implementations of `ReferenceInterface`:
    - `InstanceArray`: Can be used to define an array of references (`Instance`-objects or objects implementing `ReferenceInterface` which are automatically resolved by the Container when needed. Note: The array may contain other values. If a item is not a reference (i.E. a object of another type, a string, etc.) the item is left unchanged.
    - `Alias`: Can be used to define a path containing an alias, e.g. `"@runtime/data/path"`. This type of reference can be used in the config array if a path is used, but the defined object does not support Yii-Aliases (i.E. 3rd party, not yii-specific classes). using `\Amylian\Yii\DI\Alias:of('@app/my/path')` does the same as `\Yii:getPath('@app/my/path')`, but the latter cannot be used in configuration as the aliases are unknown when the configuration is loaded.

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist amylian/yii2-amylian-di "*"

```

or add

```
"amylian/yii2-amylian-di": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

### Use the extended Container Class as standard Container in Yii2:

[](#use-the-extended-container-class-as-standard-container-in-yii2)

Yii2 creates the global Container by automatically. The easiest way to replace it with an instance of `\Amylian\Yii\DI\Container` is to add

```
\Yii::$container = new Amylian\Yii\DI\Container();
```

right after loading Yii.php:

```
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';

\Yii::$container = new Amylian\Yii\DI\Container();  // run();
```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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://www.gravatar.com/avatar/2aac759700a1ebf5ceb3bdda6b58776648360d5215fbd53169c70ea6b5b89ada?d=identicon)[ancpru](/maintainers/ancpru)

---

Top Contributors

[![ancpru](https://avatars.githubusercontent.com/u/7736882?v=4)](https://github.com/ancpru "ancpru (13 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

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

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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