horat1us / yii2-di-bootstrap
Yii2 DI 容器 Bootstrap
1.1.1
2019-11-27 03:44 UTC
Requires
- php: >=7.2
- yiisoft/yii2: ^2.0.15
Requires (Dev)
- phpunit/phpunit: ^8.0
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-09-16 04:10:31 UTC
README
此包提供 Yii2 依赖注入容器的抽象引导。它必须在具有指定配置依赖项的包中扩展。
此包的主要目的是防止无效的容器配置。
安装
composer require horat1us/yii2-di-bootstrap:^1.1
使用方法
在你的包中实现 DI 引导
<?php namespace Package; use Horat1us\Yii\DI; class Bootstrap extends DI\Bootstrap { public function getDefinitions() : array{ return [ Package\ConfigInterface::class => Package\Config::class, ]; } }
将包引导添加到你的应用程序配置中
<?php // config.php use Package; return [ 'bootstrap' => [ 'package' => [ 'class' => Package\Bootstrap::class, 'definitions' => [ // here you can reconfigure config interface // note: another class names can not be configured here ], ], ], // ... another application configuration ];