NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #2310 most downloaded on Packagist
A PHP 5.6 compatible dependency injection container.
Last release 22 days ago
15 Sep 2026
Release timing varies
gaps range from 2 weeks to 1.2 years
Nearly every release is documented
notes for 59 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
64 releases · first in 2015
Fix typo in README.md for default modes description by @nikolaystrikhar in #71
Full Changelog: 4.1.0...4.1.1
One column per quarter.
get(Foo::class) to Foo instead of mixed (thanks @estevao90).The Container::mergeArrayVar method to the Container, enabling developers to add a list of implementations to a binding (thanks @dpanta94 ).
4.1.0
Container::mergeArrayVar method to the Container, enabling developers to add a list of implementations to a binding (thanks @dpanta94).Fixed Container::unsetOffset method behavior to ensure singletons and when-needs-gives bindings are correctly removed.
4.0.1
Container::unsetOffset method behavior to ensure singletons and when-needs-gives bindings are correctly removed.Fixed PHP 8.4 deprecation warnings.
4.0.0
Correctly bind the container to the builders and resolvers when cloning the container.
3.3.7
The afterBuildAll parameter to the bindDecorators and singletonDecorators method, fixes #61 .
3.3.6
afterBuildAll parameter to the bindDecorators and singletonDecorators method, fixes #61.Added PHPStan generics to multiple classes. IDEs that support them will get autocompletion (.phpstorm.meta.php not required) if a fully-qualified clas
3.3.5
$instance = $container->get( Test::class ); (thanks @defunctl).Implement the Container::__clone method to clone the container accessory classes correctly upon cloning.
3.3.4
Container::__clone method to clone the container accessory classes correctly upon cloning.Container::__construct method will bind itself to the Psr\Container\ContainerInterface interface as a singleton.Container class is extended, it will bind itself to the extended class in the __construct and __clone methods.Return value of the App::callback method to be callable (thanks @estevao90 ).
Set the correct return type for the Container::callback function (thanks @estevao90 ).
Allow bound interfaces to properly resolve their concrete class when the concrete class has contextual bindings (thanks @defunctl ). e.g. the followin
3.3.1
$container = new \lucatume\DI52\Container();
$container->bind(SomeInterface::class, SomeClass::class);
$container->when(Someclass:class)
->needs('$num')
->give(20);
// This now works, properly resolving SomeClass::class.
$instance = $container->get(SomeInterface::class);$container = new \lucatume\DI52\Container();
$container->bind(SomeInterface::class, SomeClass::class);
$container->when(Someclass:class)
->needs('$num')
->give(20);
// This now works, properly resolving SomeClass::class.
$instance = $container->get(SomeInterface::class);
Removed the aliases.php file from the package autoloading. Take a look at the README.md file to see how to gracefully upgrade to version 3.3
aliases.php file from the package autoloading. Take a look at the README.md file to see how to gracefully upgrade to version 3.3Correctly resolve unbound parameters to default value when available.
Allow customization of rethrown exceptions catpured during container resolution; alter message, file and line by default.
App generated methods signatures.Removed leftover @since TBD comments.
@since TBD comments.Updated GitHub workflows to remove deprecated functionality and run composer install via https://github.com/ramsey/composer-install.
unit suite and a php81 suite to avoid fatal parse errors when asserting enums.PHP81ContextualBindingContainerTest runs under PHP8.1.The container now registers Service Providers using its own Container::get() method, instead of the new keyword. This allows Service Providers to util
Container::get() method, instead of the new keyword. This allows Service Providers to utilize dependency injection. (thanks @defunctl).Add support for resolving primitive values (e.g. int, string, bool etc...) using Container::when(), Container::needs() and Container::give() (thanks @
Container::when(), Container::needs() and Container::give() (thanks @defunctl).Add .gitattributes file to exclude development artifacts. (thanks @Luc45)
.gitattributes file to exclude development artifacts. (thanks @Luc45)Add support for a default value in the lucatume\DI52\Container::getVar(string $key, mixed $default = null) :mixed method.
lucatume\DI52\Container::getVar(string $key, mixed $default = null) :mixed method.lucatume\DI52\Container::setVar(string $key, mixed $value) :void will not try to run callables when
storing variables on the container using the method. As such, the need to protect the variables when using
the setVar() method is no more required.lucatume\DI52\Container::tagged(string $tag) :array method will now return an empty array if nothing was
tagged with the tag; it would throw an error in previous versions.getProvider and get, make or the ArrayAccess API.tad_DI52_ServiceProviderInterface and tad_DI52_ContainerInterface interfaces.PHP 8.1 compatibility issues (thanks @bordoni)
PHP 8 compatibility issues (thanks @bordoni)
Error messages and format in the context of nested make resolution (thanks @Luc45)
make resolution (thanks @Luc45)PHP 5.3 and 7.4 incompatibility issues
new build tools to the repository
Container::callback code to re-use callbacks when available (thanks @sc0ttkclark)callback method would build the object for static method callssupport for one parameter singletong binding of concrete, instantiatable, classes, thanks @Luc45
add PHPStorm make method auto-completion (thanks @Luc45)
improve exception throwing to show original exceptions when the building of a bound class, interface or slug fails
an issue with array variable handling
issue with setVar method where, in some instances, variable values could not be overridden
setVar method where, in some instances, variable values could not be overriddencheck for file existence in autoload script (thanks @truongwp)
issue where non registered classes object dependencies would be built just the first time (issue #2)
fix handling of unbound interface arguments
change internal method visibility to improve compatibility with monkey patching libraries
allow unbound classes with __construct method requirements to be used in instance callbacks
__construct method requirements to be used in instance callbackssupport for use of callback to feed instance and viceversa
callback to feed instance and viceversasupport for built objects in instance and callback methods
instance and callback methodsan issue where re-binding implementations could lead to built objects still using previous bindings
the README file to update it to the new code
instance and callback methodsinstance methods)an issue where singleton resolution would result in circular reference on some Windows versions (thanks @bordoni)
support for binding replacement
snake_case method names are now set to camelCase
nested dependency resolution issue with interfaces and default values
updated tad_di512_Container bind and singleton methods signatures
tad_di512_Container bind and singleton methods signaturesmore informative exception message when trying to resolve unbound slug or non existing class
nested dependency resolving issue
more informative exception message when default primitive value is missing
support for the custom bindings
internal workings to improve performance ( using @TomBZombie benchmarks
Nothing published for this version
support for decorator pattern in PHP 5.2 compatible syntax
### Added - tests for uncovered code
singleton resolution for same implementations
- doc updates
hasTag($tag) method to the container
hasTag($tag) method to the containerisBound($classOrInterface) method to the containerthe binding and automatic resolution API (code inspiration)
resolution for objects in arrays
support for the %varName% variable notation.
%varName% variable notation.array resolution support for the Array Access API.
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →