visma/php-di-bootstrapper

0.1.0 2020-01-30 12:38 UTC

This package is auto-updated.

Last update: 2024-08-27 23:01:53 UTC


README

使用方法

创建一个空的容器(不太有用)

$bootstrap = new \Visma\PhpDiBootstrapper\Bootstrap();

$container = $bootstrap->create();

与文件一起使用

递归地加载提供的目录中的所有文件作为定义,按名称排序

$bootstrap = new \Visma\PhpDiBootstrapper\Bootstrap();
$bootstrap->addDefinitionsFromDirectory(__DIR__ . '/src/definitions/');

$container = $bootstrap->create();

与文件和容器编译一起使用

递归地加载提供的目录中的所有文件作为定义,按名称排序,只有当容器尚未编译时才读取文件

$bootstrap = new \Visma\PhpDiBootstrapper\Bootstrap();
$bootstrap->enableCompilation(__DIR__ . '/generated/container/');
$bootstrap->addDefinitionsFromDirectory(__DIR__ . '/src/definitions/');

$container = $bootstrap->create();