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

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

celema/container
================

A PSR-11 compatible dependency injection library

0.5.1(4w ago)0702MITPHPPHP ^8.5CI passing

Since Jan 31Pushed 1w agoCompare

[ Source](https://github.com/celemas/container)[ Packagist](https://packagist.org/packages/celema/container)[ Docs](https://celema.dev/container)[ RSS](/packages/celema-container/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (6)Versions (8)Used By (2)

Celema Container
================

[](#celema-container)

[![ci](https://camo.githubusercontent.com/d974f52de25abfdf8b749e932d3b5b6021978882b019d8211526a6d48ca717fa/68747470733a2f2f636f6465666c6f652e636f6d2f63656c656d612f636f6e7461696e65722f6261646765732f776f726b666c6f77732f63692e796d6c2f62616467652e7376673f7374796c653d666c6174266c6f676f3d666f7267656a6f266c6f676f436f6c6f723d7768697465266c6162656c3d6369)](https://codefloe.com/celema/container/actions)[![code coverage](https://camo.githubusercontent.com/57eb119212b5a7d20741edc138d8c30e6a9ded5456aa1e8cba9e886ce6ee594d/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d6874747073253341253246253246636f762e63656c656d612e64657625324663656c656d61253246636f6e7461696e6572253246636f646525324662616467652e6a736f6e)](https://cov.celema.dev/celema/container/code)[![type coverage](https://camo.githubusercontent.com/165c61f153365bce3abd99fb795b54fb7cbf18a3ce5207ed14c4c3998aa261d7/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d6874747073253341253246253246636f762e63656c656d612e64657625324663656c656d61253246636f6e7461696e6572253246747970657325324662616467652d636f7665722e6a736f6e)](https://cov.celema.dev/celema/container/types)[![psalm level](https://camo.githubusercontent.com/93196a1239a6e096d48c4bc5e6baae7f85e091cd262ec4eaa6b70364fcb1011e/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f75726c3d6874747073253341253246253246636f762e63656c656d612e64657625324663656c656d61253246636f6e7461696e6572253246747970657325324662616467652d6c6576656c2e6a736f6e)](https://cov.celema.dev/celema/container/types)[![Software License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md)

A PSR-11 compatible dependency injection container.

Entry lifetimes
---------------

[](#entry-lifetimes)

Container entries use explicit lifetimes:

- `shared()` caches one instance per container (default for added entries)
- `scoped()` caches one instance per requesting container scope
- `transient()` never caches
- `value()` returns the configured definition as-is (for literals or raw closures)

```
$container->add('config', ['debug' => true])->value();
$container->add(Service::class)->shared();
$container->add(RequestContext::class)->scoped();
$container->add(Builder::class)->transient();
```

Scope mode
----------

[](#scope-mode)

Use `scope()` to create an isolated container for one unit of work:

```
$root = new Container();
$root->add('app-name', 'celema')->value();
$root->add('global-service', GlobalService::class)->shared();
$root->add('request-service', RequestService::class)->scoped();

$scope = $root->scope();
$scope->add(Request::class, $request)->value();

// ... resolve request-local services
$scope->reset();
```

After the first `scope()` call, the root container is sealed and no longer accepts structural mutations. Scope tags can inherit pre-defined root tags while keeping their own local caches.

Services that should be cleaned between scopes can implement `Celema\Container\Resettable` and will be reset during `$scope->reset()`.

License
-------

[](#license)

This project is licensed under the [MIT license](LICENSE.md).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance96

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

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

Total

6

Last Release

28d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c15f1690b643e5cbf205fd28f3b2ebb6c7448d34774bb92b7952150c901a689?d=identicon)[ernstla](/maintainers/ernstla)

---

Top Contributors

[![ernstla](https://avatars.githubusercontent.com/u/683620?v=4)](https://github.com/ernstla "ernstla (156 commits)")

---

Tags

containerPSR-11dependency-injectiondiiocpsr11

### Embed Badge

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

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.9k61.2M1.4k](/packages/php-di-php-di)[slince/di

A flexible dependency injection container

20281.8k6](/packages/slince-di)[infocyph/intermix

A lightweight, high-performance PHP dependency injection and runtime utility toolkit with invocation, scoped services, compiled resolution, Closure serialization, Fence and fluent helpers.

1315.4k6](/packages/infocyph-intermix)

PHPackages © 2026

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