lucatume/di52
A PHP 5.6 compatible dependency injection container.
4.1.0
1.7M downloads/mo
#3285 most downloaded on Packagist
lucatume/di52
What this package is like to depend on
Last release 2 months ago
24 Jun 2026
Release timing varies
gaps range from 2 weeks to 1.2 years
Nearly every release is documented
notes for 58 of 62 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
63 releases · first in 2015
1 release in the last 12 months
see the full history below
Release timeline
63 releases · Nov 2015 to Jun 2026
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Releases
latest 60 of 63-
4.1.024 Jun 2026Release notes
Open source →4.1.0
Added
- The
Container::mergeArrayVarmethod to the Container, enabling developers to add a list of implementations to a binding (thanks @dpanta94).
Release notes
Open source →Added
- The
Container::mergeArrayVarmethod to the Container, enabling developers to add a list of implementations to a binding (thanks @dpanta94).
- The
-
4.0.101 Apr 2025Release notes
Open source →4.0.1
Fixed
- Fixed
Container::unsetOffsetmethod behavior to ensure singletons and when-needs-gives bindings are correctly removed.
Release notes
Open source →Fixed
- Fixed
Container::unsetOffsetmethod behavior to ensure singletons and when-needs-gives bindings are correctly removed.
- Fixed
-
4.0.014 Dec 2024Release notes
Open source →4.0.0
Changed
- Bumped minimum supported version to PHP 7.1.
- Fixed PHP 8.4 deprecation warnings.
Release notes
Open source →Changed
- Bumped minimum supported version to PHP 7.1.
- Fixed PHP 8.4 deprecation warnings.
-
3.3.726 Apr 2024Release notes
Open source →3.3.7
Fixed
- Correctly bind the container to the builders and resolvers when cloning the container.
Release notes
Open source →Fixed
- Correctly bind the container to the builders and resolvers when cloning the container.
-
3.3.602 Apr 2024Release notes
Open source →3.3.6
Added
- The
afterBuildAllparameter to thebindDecoratorsandsingletonDecoratorsmethod, fixes #61.
Release notes
Open source →Added
- The
afterBuildAllparameter to thebindDecoratorsandsingletonDecoratorsmethod, fixes #61.
- The
-
3.3.501 Sep 2023Release notes
Open source →3.3.5
Changed
- Added PHPStan generics to multiple classes. IDEs that support them will get autocompletion (.phpstorm.meta.php not required) if a fully-qualified class name is used, e.g.
$instance = $container->get( Test::class );(thanks @defunctl).
Release notes
Open source →Changed
- Added PHPStan generics to multiple classes. IDEs that support them will get autocompletion (.phpstorm.meta.php not required) if a fully-qualified class name is used, e.g.
$instance = $container->get( Test::class );.
- Added PHPStan generics to multiple classes. IDEs that support them will get autocompletion (.phpstorm.meta.php not required) if a fully-qualified class name is used, e.g.
-
3.3.420 Jun 2023Release notes
Open source →3.3.4
Added
- Implement the
Container::__clonemethod to clone the container accessory classes correctly upon cloning.
Changed
- The
Container::__constructmethod will bind itself to thePsr\Container\ContainerInterfaceinterface as a singleton. - If the
Containerclass is extended, it will bind itself to the extended class in the__constructand__clonemethods.
Release notes
Open source →Added
- Implement the
Container::__clonemethod to clone the container accessory classes correctly upon cloning.
Changed
- The
Container::__constructmethod will bind itself to thePsr\Container\ContainerInterfaceinterface as a singleton. - If the
Containerclass is extended, it will bind itself to the extended class in the__constructand__clonemethods.
- Implement the
-
3.3.328 Apr 2023Release notes
Open source →Release notes
Open source →Fixed
- Return value of the
App::callbackmethod to becallable(thanks @estevao90).
- Return value of the
-
3.3.207 Apr 2023Release notes
Open source →Release notes
Open source →Fixed
- Set the correct return type for the
Container::callbackfunction (thanks @estevao90).
- Set the correct return type for the
-
3.3.117 Mar 2023Release notes
Open source →3.3.1
Fixed
- Allow bound interfaces to properly resolve their concrete class when the concrete class has contextual bindings (thanks @defunctl). e.g. the following will now work properly:
$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);
Release notes
Open source →Fixed
- Allow bound interfaces to properly resolve their concrete class when the concrete class has contextual bindings (thanks @defunctl). e.g. the following will now work properly:
$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); -
3.3.028 Feb 2023Release notes
Open source →Breaking change
- Removed the
aliases.phpfile from the package autoloading. Take a look at the README.md file to see how to gracefully upgrade to version 3.3
- Removed the
-
3.2.128 Feb 2023Release notes
Open source →Fixed
- Correctly resolve unbound parameters to default value when available.
-
3.2.027 Feb 2023Release notes
Open source →Changed
- Allow customization of rethrown exceptions catpured during container resolution; alter message, file and line by default.
Fixed
- Some
Appgenerated methods signatures.
-
3.1.116 Feb 2023 -
3.1.028 Jan 2023Release notes
Open source →Added
- PHP8.2 support.
- Parameter detection support for PHP Union Types.
- Parameter Enum detection/Enum container resolving.
- thanks @defunctl.
Changed
- Add PHP8.2 to GitHub workflow matrix.
- Separated tests into a
unitsuite and aphp81suite to avoid fatal parse errors when asserting enums. - Updated GitHub workflows to remove deprecated functionality and run composer install via https://github.com/ramsey/composer-install.
- Updated GitHub workflows to attempt to automatically migrate the phpunit configuration file based on the current version being run.
- Updated deprecated "actions/checkout" GitHub action from v2 to v3.
- thanks @defunctl.
Fixed
- Use the correct PHP version ID to ensure
PHP81ContextualBindingContainerTestruns under PHP8.1. - Fixed the phpunit.xml schema to validate against phpunit 5.7.
- Fatal Error Handling snapshots.
- thanks @defunctl.
-
3.0.324 Jan 2023Release notes
Open source →Added
- The container now registers Service Providers using its own
Container::get()method, instead of thenewkeyword. This allows Service Providers to utilize dependency injection. (thanks @defunctl). - Additional contextual binding examples for primitives + service provider documentation in the README.
- The container now registers Service Providers using its own
-
3.0.220 Jan 2023Release notes
Open source →Added
- Add support for resolving primitive values (e.g. int, string, bool etc...) using
Container::when(),Container::needs()andContainer::give()(thanks @defunctl).
- Add support for resolving primitive values (e.g. int, string, bool etc...) using
-
3.0.116 Nov 2022Release notes
Open source →Changed
- Add
.gitattributesfile to exclude development artifacts. (thanks @Luc45)
- Add
-
3.0.009 Feb 2022Release notes
Open source →Changed
- Add support for a default value in the
lucatume\DI52\Container::getVar(string $key, mixed $default = null) :mixedmethod. - The
lucatume\DI52\Container::setVar(string $key, mixed $value) :voidwill not try to run callables when storing variables on the container using the method. As such, the need to protect the variables when using thesetVar()method is no more required. - The
lucatume\DI52\Container::tagged(string $tag) :arraymethod will now return an empty array if nothing was tagged with the tag; it would throw an error in previous versions. - Rewritten the code to fully leverage Closure support.
- Move build tools to Docker.
- Make the container implementation compatible with [PSR-11 Container specification](https://www.php-fig. org/psr/psr-11/)
- Fix #26 to handle and format files syntax errors while trying to autoload.
- Fix #13 and allow explicit definition of default binding method.
- Allow getting the registered provider instances using
getProviderandget,makeor theArrayAccessAPI. - Allow getting callbacks for static and instance methods consistently to unhook.
- Add phstan, phan and phpcs checks.
- Move benchmarks to Docker, automate them.
- Update documentation and examples.
Removed
- Removed the
tad_DI52_ServiceProviderInterfaceandtad_DI52_ContainerInterfaceinterfaces.
- Add support for a default value in the
-
2.1.520 Dec 2021 -
2.1.401 Jan 2021 -
2.1.302 Nov 2020Release notes
Open source →Fixed
- Error messages and format in the context of nested
makeresolution (thanks @Luc45)
- Error messages and format in the context of nested
-
2.1.227 Oct 2020Release notes
Open source →Fixed
- PHP 5.3 and 7.4 incompatibility issues
Changed
- moved the builds to GitHub Actions
-
2.1.123 Oct 2020Release notes
Open source →Added
- new build tools to the repository
Changed
- refactor
Container::callbackcode to re-use callbacks when available (thanks @sc0ttkclark)
Fixed
- fix an issue where the Closure produced by the
callbackmethod would build the object for static method calls
-
2.1.014 Jul 2020Release notes
Open source →Added
- support for one parameter singletong binding of concrete, instantiatable, classes, thanks @Luc45
-
2.0.1214 Oct 2019 -
2.0.1126 Sep 2019Release notes
Open source →Changed
- improve exception throwing to show original exceptions when the building of a bound class, interface or slug fails
-
2.0.1029 Oct 2018Release notes
Open source →Fixed
- an issue with array variable handling
- made error message more clear for non-string offsets
-
2.0.926 Sep 2017Release notes
Open source →Fixed
- issue with
setVarmethod where, in some instances, variable values could not be overridden
- issue with
-
2.0.818 Jul 2017 -
2.0.715 Jun 2017Release notes
Open source →Fixed
- issue where non registered classes object dependencies would be built just the first time (issue #2)
-
2.0.609 May 2017 -
2.0.521 Apr 2017Release notes
Open source →Changed
- change internal method visibility to improve compatibility with monkey patching libraries
-
2.0.422 Feb 2017Release notes
Open source →Fixed
- allow unbound classes with
__constructmethod requirements to be used ininstancecallbacks
- allow unbound classes with
-
2.0.307 Feb 2017 -
2.0.202 Feb 2017 -
2.0.123 Jan 2017Release notes
Open source →Fixed
- an issue where re-binding implementations could lead to built objects still using previous bindings
Changed
- removed some dead code left over from previous iterations
-
2.0.021 Jan 2017Release notes
Open source →Added
instanceandcallbackmethods
Changed
- refactored the code completely
- the README file to update it to the new code
Removed
- support for array based construction instructions (see
instancemethods)
-
1.4.519 Jan 2017Release notes
Open source →Fixed
- an issue where singleton resolution would result in circular reference on some Windows versions (thanks @bordoni)
-
1.4.409 Jan 2017 -
1.4.318 Oct 2016Release notes
Open source →Changed
- snake_case method names are now set to camelCase
Fixed
- an inheritance issue on PHP 5.2
- non PHP 5.2 compatible tests
Added
- Travis CI support and build
-
1.4.214 Oct 2016Release notes
Open source →Fixed
- nested dependency resolution issue with interfaces and default values
-
1.4.114 Oct 2016 -
1.4.014 Oct 2016Release notes
Open source →Added
- more informative exception message when trying to resolve unbound slug or non existing class
- support for after build methods
Fixed
- another nested dependency resolving issue
-
1.3.228 Jul 2016 -
1.3.118 Apr 2016Release notes
Open source →Added
- more informative exception message when default primitive value is missing
-
1.3.018 Apr 2016Release notes
Open source →Added
- support for the custom bindings
- support for same class singleton binding
Changed
- performance optimization
-
1.2.611 Apr 2016Release notes
Open source →Changed
- internal workings to improve performance ( using @TomBZombie benchmarks
-
1.2.6-alpha07 Apr 2016 pre-releaseNothing published for this version
-
1.2.506 Apr 2016Release notes
Open source →Added
- support for decorator pattern in PHP 5.2 compatible syntax
- code highlighting for code examples in doc (thanks @omarreiss)
-
1.2.405 Apr 2016 -
1.2.305 Apr 2016 -
1.2.213 Feb 2016 -
1.2.123 Jan 2016Release notes
Open source →Added
hasTag($tag)method to the containerisBound($classOrInterface)method to the container- support for deferred service providers
-
1.2.022 Jan 2016 -
1.1.219 Jan 2016 -
1.1.119 Jan 2016 -
1.1.018 Jan 2016 -
1.0.329 Nov 2015Nothing published for this version
-
1.0.225 Nov 2015Nothing published for this version