erip / ldic
A lightweight dependency injection container for PHP.
1.0
2020-06-24 20:40 UTC
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: 7.*
This package is auto-updated.
Last update: 2024-05-25 05:58:26 UTC
README
LDic, is a lightweight dependency injection container for php. Just with 3 public functions and less than 130 lines of code.
Install
Via Composer
$ composer require erip/ldic
Usage
class Foo {} $container = new Erip\LDic(); $container->register(new Foo()); $productUtils = $container->resolve(Foo::class); // Lazy Registration // This dependency will be created only when needed. $container->lazyRegister(function(){ return new Foo(); }); $productUtils = $container->resolve(Foo::class);
Testing
$ phpunit
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.