di52

The dependency injection container for streamlined WordPress development. Easily manage and inject dependencies for efficient and hassle-free app creation.

Downloads
712.2K
Stars
59
Committers
10
di52 - https://github.com/lucatume/di52/releases/tag/3.3.7 Latest Release

Published by lucatume 6 months ago

3.3.7

Fixed

  • Correctly bind the container to the builders and resolvers when cloning the container.
di52 - https://github.com/lucatume/di52/releases/tag/3.3.6

Published by lucatume 7 months ago

3.3.6

Added

  • The afterBuildAll parameter to the bindDecorators and singletonDecorators method, fixes #61.
di52 -

Published by lucatume about 1 year ago

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).
di52 - https://github.com/lucatume/di52/releases/tag/3.3.4

Published by lucatume over 1 year ago

3.3.4

Added

  • Implement the Container::__clone method to clone the container accessory classes correctly upon cloning.

Changed

  • The Container::__construct method will bind itself to the Psr\Container\ContainerInterface interface as a singleton.
  • If the Container class is extended, it will bind itself to the extended class in the __construct and __clone methods.
di52 - https://github.com/lucatume/di52/releases/tag/3.3.3

Published by lucatume over 1 year ago

3.3.3

Fixed

  • Return value of the App::callback method to be callable (thanks @estevao90).
di52 - https://github.com/lucatume/di52/releases/tag/3.3.2

Published by lucatume over 1 year ago

3.3.2

Fixed

  • Set the correct return type for the Container::callback function (thanks @estevao90).
di52 - https://github.com/lucatume/di52/releases/tag/3.3.1

Published by lucatume over 1 year ago

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);
di52 - https://github.com/lucatume/di52/releases/tag/3.3.0

Published by lucatume over 1 year ago

3.3.0

Breaking change

  • 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
di52 - https://github.com/lucatume/di52/releases/tag/3.2.1

Published by lucatume over 1 year ago

3.2.1

Fixed

  • Correctly resolve unbound parameters to default value when available.
di52 - https://github.com/lucatume/di52/releases/tag/3.2.0

Published by lucatume over 1 year ago

3.2.0

Changed

  • Allow customization of rethrown exceptions catpured during container resolution; alter message, file and line by default.

Fixed

  • Some App generated methods signatures.
di52 - https://github.com/lucatume/di52/releases/tag/3.1.1

Published by lucatume over 1 year ago

3.1.1

Changed

  • Removed leftover @since TBD comments.
di52 - https://github.com/lucatume/di52/releases/tag/3.1.0

Published by lucatume over 1 year ago

3.1.0

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 unit suite and a php81 suite 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 PHP81ContextualBindingContainerTest runs under PHP8.1.
  • Fixed the phpunit.xml schema to validate against phpunit 5.7.
  • Fatal Error Handling snapshots.
  • thanks @defunctl.
di52 - https://github.com/lucatume/di52/releases/tag/3.0.3

Published by lucatume almost 2 years ago

3.0.3

Added

  • The container now registers Service Providers using its own Container::get() method, instead of the new keyword. This allows Service Providers to utilize dependency injection. (thanks @defunctl).
  • Additional contextual binding examples for primitives + service provider documentation in the README.
di52 - https://github.com/lucatume/di52/releases/tag/3.0.2

Published by lucatume almost 2 years ago

3.0.2

Added

  • Add support for resolving primitive values (e.g. int, string, bool etc...) using Container::when(), Container::needs() and Container::give() (thanks @defunctl).
di52 - https://github.com/lucatume/di52/releases/tag/3.0.1

Published by lucatume almost 2 years ago

3.0.1

Changed

  • Add .gitattributes file to exclude development artifacts. (thanks @Luc45)
di52 - https://github.com/lucatume/di52/releases/tag/3.0.0

Published by lucatume over 2 years ago

3.0.0

Changed

  • Add support for a default value in the lucatume\DI52\Container::getVar(string $key, mixed $default = null) :mixed method.
  • The 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.
  • The 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.
  • 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 getProvider and get, make or the ArrayAccess API.
  • 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_ServiceProviderInterface and tad_DI52_ContainerInterface interfaces.
di52 - 2.1.5

Published by lucatume almost 3 years ago

Fixed

  • PHP 8.1 compatibility issues (thanks @bordoni)
di52 - 2.1.4

Published by lucatume almost 4 years ago

Fixed

  • PHP 8 compatibility issues (thanks @bordoni)
di52 - 2.1.3

Published by lucatume almost 4 years ago

Fixed

  • Error messages and format in the context of nested make resolution (thanks @Luc45)
di52 - 2.1.1

Published by lucatume about 4 years ago

Added

  • new build tools to the repository

Changed

  • refactor Container::callback code to re-use callbacks when available (thanks @sc0ttkclark)

Fixed

  • fix an issue where the Closure produced by the callback method would build the object for static method calls