Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/petrgrishin/yiipimple

[deprecated] Integration dependency injection container Pimple in Yii framework
https://github.com/petrgrishin/yiipimple

Last synced: 23 days ago
JSON representation

[deprecated] Integration dependency injection container Pimple in Yii framework

Awesome Lists containing this project

README

        

yiipimple
=========

Integration dependency injection container Pimple in Yii framework

1) Install Pimple

composer.json:
```json
{
"require": {
"petrgrishin/yiipimple": "dev-master"
}
}
```

2) Change the entry scripts

Just change this
```php
Yii::createWebApplication($config)->run();
```
into
```php
Yii::createApplication('\YiiPimple\WebApplication', $config)->run();
```

3) Configuration

```php
return array(
// ...
// dipendency injection configuration
'container' => array(
'class' => '\YiiPimple\CContainer',
'services' => array(
// ... put here your services
);
),
// ...
);
```

4) Retrieve services

```php
$service = Yii::app()->getContainer()->get('service');
```

```php
// yii urlManager
$urlManager = Yii::app()->getContainer()->get('yii.core.urlManager');
```