horat1us / yii2-di-bootstrap
Yii2 DI Container Bootstrap
Installs: 1 321
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
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-11-16 04:28:35 UTC
README
This package provides abstract bootstrap for Yii2 dependency injection container. It have to be extended in packages with specifying available for configuration dependencies.
Main purpose of this package to prevent invalid container configuration.
Installation
Using packagist.org:
composer require horat1us/yii2-di-bootstrap:^1.1
Usage
Implement DI Bootstrap in your package
<?php namespace Package; use Horat1us\Yii\DI; class Bootstrap extends DI\Bootstrap { public function getDefinitions() : array{ return [ Package\ConfigInterface::class => Package\Config::class, ]; } }
Append package Bootstrap to your application configuration
<?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 ];