Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/petrgrishin/yiipimple
- Owner: petrgrishin
- Created: 2013-06-08T19:26:54.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-06-10T06:21:51.000Z (over 11 years ago)
- Last Synced: 2024-11-08T16:16:59.763Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 137 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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');
```