Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 691 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 691 Bytes

yii-php-di

PHP-DI integration for Yii 1. @see http://php-di.org/

Requirements

Installation

  1. Place the wrapper in your application. (@todo: Composer install)
  2. Add the application component in config/main.php:
'components' => array(
    ...
    'container' => array(
        'class' => 'path.to.DIContainerWrapper',
        //'definitions' => array()
    ),
    ...

Usage

Only call the container from your controllers. Don't call or inject the container on a lower level (into models or components), or you are not really using Dependency Injection.

Yii::app()->container->get('MyClass');