Simple and lightweight Dependency Injection Container

v1.0.0 2015-09-14 17:47 UTC

This package is auto-updated.

Last update: 2020-01-11 17:52:12 UTC


Build Status Scrutinizer Coverage License

This library provides a simple and lightweight Dependency Injection Container.


  • Interfaces: Extended container interfaces compatible with container-interop

    • EditableContainerInterface

    • LockableContainerInterface

  • Classes: Advanced and feature-complete container implementations based on the interfaces

    • EditableContainer

    • LockableContainer


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

namespace Acme\MyApplication;

use FlameCore\Container\EditableContainer;

$container = new EditableContainer();

You can define() items to require a value type. To assign values to items, use the set() method.

$container->define('bar', 'Acme\MyApplication\Config'); // or 'Config::class'
$container->set('bar', new Config());

This works also with arrays and scalar types:

$container->define('foo', ':string');
$container->set('foo', 'bar');


Install via Composer

Install Composer if you don't already have it present on your system:

$ curl -sS https://getcomposer.org/installer | php

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

$ composer require flamecore/container


  • You must have at least PHP version 5.4 installed on your system.


If you want to contribute, please see the CONTRIBUTING file first.

Thanks to the contributors:

  • Christian Neff (secondtruth)