File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ Just clone the repository in a common location or inside your project:
6161git clone https://github.com/phpMv/phpMv-UI.git
6262```
6363
64- ##II PHP framework configuration
64+ ##II PHP frameworks configuration
6565###Library loading
6666phpMv-UI complies with [ PSR-4 recommendations] ( http://www.php-fig.org/psr/psr-4/ ) for auto-loading classes.
6767Whatever 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+ ```
You can’t perform that action at this time.
0 commit comments