bigbit / di-bootstrap
应用依赖注入容器启动
v2.0.1
2020-04-01 12:18 UTC
Requires
- php: ^7.4.0
- psr/container: ^1.0
Requires (Dev)
- phpstan/phpstan: ^0.11.15
- phpunit/phpunit: ^8.2
Suggests
- bigbit/oddin: ^2.0.0
- bigbit/smart-di: ^2.0.2
README
使用PHP7.4的依赖启动应用依赖注入容器
示例
use BigBIT\DIBootstrap\Bootstrap; Bootstrap::useVendorPath(dirname(__DIR__) . DIRECTORY_SEPARATOR . "vendor"); Bootstrap::useContainerImplementation(BigBIT\SmartDI\SmartContainer::class); $bindings = [ SomeInterface::class => function(ContainerInterface $container) { return new SomeImplementation($container); } ]; $container = Bootstrap::getContainer(); $app = new App($container); $app->run();