visma / php-di-bootstrapper
0.1.0
2020-01-30 12:38 UTC
Requires
- php: ^7.4
- php-di/php-di: ^6
- webmozart/assert: ^1.6
Requires (Dev)
- phpunit/phpunit: ^8.5
- squizlabs/php_codesniffer: ^3.5
- vimeo/psalm: ^3.8
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();