PHPackages                             ranyuen/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. ranyuen/di

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

ranyuen/di
==========

Annotation based simple DI &amp; AOP at PHP.

0.2.3(4y ago)82391[1 issues](https://github.com/Ranyuen/Di/issues)1GPL-3.0+PHPPHP &gt;=7.4.0

Since Oct 29Pushed 4y ago7 watchersCompare

[ Source](https://github.com/Ranyuen/Di)[ Packagist](https://packagist.org/packages/ranyuen/di)[ RSS](/packages/ranyuen-di/feed)WikiDiscussions master Synced 1mo ago

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

```
![test](https://github.com/Ranyuen/Di/workflows/test/badge.svg)

# Ranyuen/Di

Annotation based simple DI (Dependency Injection) & AOP (Aspect Oriented Programming) at PHP.

## Features

1. Compatible with [Pimple 3](http://pimple.sensiolabs.org/).
2. Zero configuration. Injection through reflection and annotations. It's easy!
3. AOP support.

## Install

```sh
composer require ranyuen/di
```

Support PHP >=7.4.

## DI Example

Ranyuen/Di just extends Pimple. So we can use this same as Pimple 3.

```php

```

Basic Ray.Di and PHP-DI style _@Inject_ annotations example. Inject to constructor & properties.

```php

```

Inject to properties.

```php

```

Detect with type hinting through _bind_ method.

```php

```

Assign services with another names by _@Named_ annotation.

```php

```

We can use every methods that are defined at Pimple: _factory_, _protect_, _extend_ and _raw_. Below is binding example with _factory_.

```php

```

Take out DI instance by static access. We call this "Facade", like Laravel framwork.

```php

```

## AOP Example

Basic AOP example.

```php

```

Is there no annotation for AOP? Yes we can!

```php

```

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.9% 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 ~367 days

Recently: every ~632 days

Total

8

Last Release

1644d ago

PHP version history (3 changes)0.0.1PHP &gt;=5.3.0

0.1.0PHP &gt;=5.4.0

0.2.3PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8346050a44f2079f3f94a7f24aeb724acc0fdf285199a454d446b624fb7fb36e?d=identicon)[ne\_sachirou](/maintainers/ne_sachirou)

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

---

Top Contributors

[![ne-sachirou](https://avatars.githubusercontent.com/u/452772?v=4)](https://github.com/ne-sachirou "ne-sachirou (91 commits)")[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (1 commits)")

---

Tags

containeraopdependency-injectionannotationsdiaspectmethod invocationcode gen

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[aura/di

A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.

356968.3k58](/packages/aura-di)[mrclay/props-dic

Props is a simple DI container that allows retrieving values via custom property and method names

3611.7M3](/packages/mrclay-props-dic)[slince/di

A flexible dependency injection container

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

A PSR-11 compliant autowiring dependency injection container.

2857.5k2](/packages/capsule-di)

PHPackages © 2026

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