- Requires: PHP >= 7.0.0
- Latest: TBD
- Supported Until: TBD
<?php $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.
Interoperabiity. Container is an implementation of PSR-11.
Speed. Because Container is simple, it is also very fast.
Service Providers allow you to package code or configuration for packages that you reuse regularly.
Inflectors allow you to manipulate objects resolved through the container based on the type.
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.