bigbit/di-bootstrap

应用依赖注入容器启动

v2.0.1 2020-04-01 12:18 UTC

This package is auto-updated.

Last update: 2024-08-29 05:37:43 UTC


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();