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

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

flamecore/container
===================

Simple and lightweight Dependency Injection Container

v1.0.0(5y ago)0371MITPHPPHP &gt;=7.2

Since Aug 12Pushed 5y ago2 watchersCompare

[ Source](https://github.com/flamecore/flamecore-container)[ Packagist](https://packagist.org/packages/flamecore/container)[ Docs](https://www.flamecore.org)[ Fund](https://liberapay.com/flamecore)[ RSS](/packages/flamecore-container/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

FlameCore Container
===================

[](#flamecore-container)

[![Latest Stable](https://camo.githubusercontent.com/0baf1a83e35a3a9a3be0bae1eb6d2e55d4f8f536ff3e1653b3e918897cce2f77/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c616d65636f72652f636f6e7461696e65722e737667)](https://packagist.org/p/flamecore/container)[![Build Status](https://camo.githubusercontent.com/833f515a973a7e77adf5fdac5c0d6c8e2410fa799bef49f6388541043724cd97/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f636f6d2f666c616d65636f72652f666c616d65636f72652d636f6e7461696e65722e737667)](https://travis-ci.com/github/flamecore/flamecore-container)[![Scrutinizer](https://camo.githubusercontent.com/5d8a6c4bb6093fa8c8e9431e2e8847a334fba8cc942cd50fe4a8d44ffaa46a37/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f666c616d65636f72652f666c616d65636f72652d636f6e7461696e65722e737667)](https://scrutinizer-ci.com/g/flamecore/flamecore-container)[![Coverage](https://camo.githubusercontent.com/64bec0dc377be2a811db9303ee93eb173119e8d35e97833667a3ef44656a7bfd/687474703a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f666c616d65636f72652f666c616d65636f72652d636f6e7461696e65722e737667)](https://scrutinizer-ci.com/g/flamecore/flamecore-container)[![License](https://camo.githubusercontent.com/4ebfb0bbaefa60a6ab6b6b0364aba209e47a29addfe38d0fa30bffebb90792b5/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f666c616d65636f72652f636f6e7461696e65722e737667)](https://www.flamecore.org/projects/container)

This library provides a simple and lightweight Dependency Injection Container.

Features
--------

[](#features)

- **Interfaces:** Extended container interfaces compatible with *PSR-11*

    - `ModifiableContainerInterface` exposes methods to write and remove container entries.
    - `DefinableContainerInterface` exposes methods to define container entries.
    - `FactoryContainerInterface` exposes a method to create new object instances from a factory entry.
    - `LockableContainerInterface` exposes methods to lock and unlock container entries.
- **Classes:** Advanced and feature-complete container implementations based on the interfaces

    - `Container` implements common features like defining, writing, instantiating and removing container entries.
    - `LockableContainer` extends the above container to enable locking and unlocking of container entries.

Usage
-----

[](#usage)

To make use of the API, include the vendor autoloader and use the classes:

```
namespace Acme\MyApplication;

use FlameCore\Container\Container;

$container = new Container();
```

You can use `get()` and `has()` on the container as usual. You can also `set()` and `remove()` entries.

```
$container->set('foo', new Configuration(...));
if ($container->has('foo')) {
    $value = $container->get('foo'); // Returns Acme\MyApplication\Configuration object
    $container->remove('foo');
}
```

You can also use object factories:

```
$container->set('bar', function () {
    return new Configuration(...);
});
$value2 = $container->get('bar'); // Returns Acme\MyApplication\Configuration object
```

You can also get a fallback value if an entry is not set:

```
$value3 = $container->getOr('foobar', function () {
    return new Fallback(...);
}); // Returns Acme\MyApplication\Fallback object
```

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

[](#installation)

[Install Composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos) if you don't already have it present on your system.

To install the library, run the following command and you will get the latest version:

```
$ php composer.phar require flamecore/container

```

Requirements
------------

[](#requirements)

- You must have at least PHP version 7.2 installed on your system.

Contributors
------------

[](#contributors)

If you want to contribute, please see the [CONTRIBUTING](CONTRIBUTING.md) file first.

Thanks to the contributors:

- Christian Neff (secondtruth)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

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

Total

2

Last Release

2105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/82268b2432ab90f14c62445938bc3cd1340dc66e0463035df57891826b418016?d=identicon)[secondtruth](/maintainers/secondtruth)

---

Top Contributors

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

---

Tags

composer-packagecontainerdependency-injectionphp-librarypsr-11containerPSR-11dependency-injectiondi

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[php-di/php-di

The dependency injection container for humans

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

A flexible dependency injection container

20260.4k6](/packages/slince-di)

PHPackages © 2026

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