The League of Extraordinary Packages

Our Packages:

Presented by The League of Extraordinary Packages


A simple but powerful dependency injection container.

$ composer require league/container



$container = new League\Container\Container;

// add a service to the container
$container->add('service', 'Acme\Service\SomeService');

// retrieve the service from the container
$service = $container->get('service');

var_dump($service instanceof Acme\Service\SomeService); // true


Container is a simple but powerful dependency injection container that allows you to decouple components in your application in order to write clean and testable code.

It is framework agnostic as well as being very fast because of it’s simple API.

  1. Simple API

  2. Interoperabiity. Container is an implementation of PSR-11.

  3. Speed. Because Container is simple, it is also very fast.

  4. Service Providers allow you to package code or configuration for packages that you reuse regularly.

  5. Inflectors allow you to manipulate objects resolved through the container based on the type.


Patches & Security Fixes

League\Container 2.x

  • Requires: PHP >= 5.4.0
  • Latest: 2.4.0 - 2017-03
  • Supported Until: TBD

Full Documentation

No Longer Supported

League\Container 1.x

  • Requires: PHP >= 5.4.0
  • Latest: 1.3.2 - 2015-04
  • Supported Until: 2015-10

Full Documentation

Once a new major version is released, the previous stable release remains supported for six more months through patches and security fixes.


League\Container was created by Phil Bennett. Find him on Twitter at @philipobenito.