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

AbandonedArchivedLibrary[Framework](/categories/framework)

fabs/di
=======

Dependency Injection for PHP

v1.03(8y ago)21331MITPHP

Since Mar 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Fabsolute/Dependency-Injection-for-PHP)[ Packagist](https://packagist.org/packages/fabs/di)[ RSS](/packages/fabs-di/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

Dependency Injection for PHP
============================

[](#dependency-injection-for-php)

Library that provides ways to use DI for PHP developers.

Install
-------

[](#install)

Install the library like this `composer require fabs/di`

Quick Start
-----------

[](#quick-start)

Set a service with lazy loading

```
$di = DI::getDefault();

$di->set('function_example',function(){
    return new MyCustomService();
});
// or
$di->set('class_name_example', MyCustomService::class);
// or
$di->set('parameter_example',function($first,$second){
    return new MyCustomService($first, $second);
})->setParameters([1,'second']);
```

Set a service without lazy loading

```
$di = DI::getDefault();

$di->set('test_service', new MyCustomService());
```

Set a shared service

```
$di = DI::getDefault();

$di->setShared('test_service', new MyCustomService());
// or
$di->set('test_service', new MyCustomService(), true);
```

Get a service

```
$di = DI::getDefault();

$service = $di->get('test_service');
// or
$service = $di['test_service'];
// or
$service = $di->get('parameter_example',[8,'example']);
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity67

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

Total

4

Last Release

3053d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11666659?v=4)[Ahmet Türk](/maintainers/fabsolute)[@Fabsolute](https://github.com/Fabsolute)

---

Top Contributors

[![Fabsolute](https://avatars.githubusercontent.com/u/11666659?v=4)](https://github.com/Fabsolute "Fabsolute (3 commits)")

---

Tags

phpdependencyinjectiondependency-injectiondi

### Embed Badge

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

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

###  Alternatives

[yiisoft/di

Yii DI container

2361.3M115](/packages/yiisoft-di)[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2859.2k2](/packages/capsule-di)

PHPackages © 2026

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