PHPackages                             redot/container - 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. redot/container

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

redot/container
===============

Minimal, Lightweight, and Fast PHP Dependency Injection Container.

0.0.1(3y ago)42MITPHPPHP &gt;=8.0CI passing

Since Nov 16Pushed 10mo agoCompare

[ Source](https://github.com/redot-src/php-container)[ Packagist](https://packagist.org/packages/redot/container)[ GitHub Sponsors](https://github.com/AbdelrhmanSaid)[ RSS](/packages/redot-container/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Redot PHP Container
===================

[](#redot-php-container)

[![tests](https://github.com/redot-src/php-container/actions/workflows/php.yml/badge.svg)](https://github.com/redot-src/php-container/actions/workflows/php.yml)

*Minimal, Lightweight, and Fast PHP Dependency Injection Container*

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

[](#installation)

```
composer require redot/container
```

Testing
-------

[](#testing)

```
composer test
```

Usage
-----

[](#usage)

The methodologies of the container are based on the [Dependency Injection](https://en.wikipedia.org/wiki/Dependency_injection) paradigm, using the [`ReflectionClass`](https://php.net/manual/en/class.reflectionclass.php) to get class dependencies.

To use the container, you must first create a new instance of the container.

```
use Redot\Container\Container;

$container = new Container();
```

Or just use the static method `Container::getInstance()`, that will return the globally available container if it exists, or create a new one.

```
$container = Container::getInstance();
```

After you have created the container, you can bind your dependencies to the container.

```
$container->bind(Foo::class);
```

Also, you can create a singleton, that will be returned every time you call the `get` method.

```
$container->singleton('foo', function () {
    // ...
});
```

*Singletons are useful for classes that are expensive to instantiate, but only need to be created once.*

To get a dependency from the container, you can call the `make` method.

```
$foo = $container->make('foo');
```

The main difference between `make` and `get` is that `make` accepts a second parameter, which is an array of parameters to pass to the constructor of the class, while `get` does not *because of implementing PSR-11*

By the way you can also create an alias for a class, so you can call it with a different name.

```
$container->alias(Foo::class, 'bar');
```

Auto-wiring
-----------

[](#auto-wiring)

Don't worry about the auto-wiring, the container will do it for you.

```
$container->make(BrandNewClass::class);
```

It will automatically bind the dependencies of the class, and if the class has a constructor, it will pass the dependencies to it, also the container can inject specific method dependencies using the `call` method.

```
$container->call([Foo::class, 'setBar'], ['bar' => $bar]);
```

And that's it! Enjoy ✌.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% 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

Unknown

Total

1

Last Release

1279d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fe62c6597d6411df01b9d1c769a0134d825b1462dc7bad4c2524d4150019a5a?d=identicon)[AbdelrhmanSaid](/maintainers/AbdelrhmanSaid)

---

Top Contributors

[![AbdelrhmanSaid](https://avatars.githubusercontent.com/u/70618755?v=4)](https://github.com/AbdelrhmanSaid "AbdelrhmanSaid (33 commits)")[![cursoragent](https://avatars.githubusercontent.com/u/199161495?v=4)](https://github.com/cursoragent "cursoragent (3 commits)")

---

Tags

containerdependency-injectionphpcontainerdependencyinjection

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/redot-container/health.svg)

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

###  Alternatives

[league/container

A fast and intuitive dependency injection container.

86387.8M343](/packages/league-container)[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)
