This simple container ...
<?php
use AntoineDly\Container\Container;
$container = new Container();
$container->set('SomeClassOrInterface', 'SomeConcreteClass');
$container->get('SomeClassOrInterface'); //will return 'SomeConcreteClass' being resolved
- AntoineDly\Container
^1.0
works with PHP 8.2 or above.
Antoine Delaunay - antoine.delaunay333@gmail.com - Twitter
AntoineDly\Container is licensed under the MIT License - see the LICENSE file for details
This library is heavily inspired by PHP-DI and Gio's Container
If you want to contribute, make sure to run those 3 steps before submitting a PR :
- Run static tests :
tools/phpstan/vendor/bin/phpstan analyse src tests --level=9
- Run fixer :
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix src
- Run tests :
vendor/bin/phpunit tests