Skip to content

Commit e0f69be

Browse files
authored
Doc for Yii configuration
1 parent c3a2e15 commit e0f69be

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Just clone the repository in a common location or inside your project:
6161
git clone https://github.com/phpMv/phpMv-UI.git
6262
```
6363

64-
##II PHP framework configuration
64+
##II PHP frameworks configuration
6565
###Library loading
6666
phpMv-UI complies with [PSR-4 recommendations](http://www.php-fig.org/psr/psr-4/) for auto-loading classes.
6767
Whatever the php framework used, with "composer", it is enough to integrate the Composer autoload file.
@@ -162,3 +162,21 @@ In the same file, register a new dependency :
162162
```php
163163
\Yii::$container->setSingleton("Ajax\php\yii\JsUtils",["bootstrap"=>new Ajax\Semantic()]);
164164
```
165+
####Injection of the service
166+
The **JsUtils** singleton can then be injected into controllers
167+
168+
```php
169+
namespace app\controllers;
170+
171+
use yii\web\Controller;
172+
use Ajax\php\yii\JsUtils;
173+
174+
class SiteController extends Controller{
175+
protected $jquery;
176+
177+
public function __construct($id, $module,JsUtils $js){
178+
parent::__construct($id, $module);
179+
$this->jquery=$js;
180+
}
181+
}
182+
```

0 commit comments

Comments
 (0)