shqear / yii2-embedjs
Embed JS with IDE checking or intellisense.
dev-master
2018-04-24 17:31 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2026-03-15 02:51:47 UTC
README
this is a fork package from mitrii/yii2-embedjs
Yii2 embed JS
Embed JS with IDE checking or intellisense
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist shqear/yii2-embedjs "*"
or add
"shqear/yii2-embedjs": "*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
<?php \shqear\widgets\Embedjs::begin(); ?> <script type="text/javascript"> console.log('Hello, world!'); </script> <?php \shqear\widgets\Embedjs::end(); ?>
Or with 'position' option (The default option is POS_END)
<?php \shqear\widgets\Embedjs::begin(['position' => \yii\web\View::POS_READY]); ?> <script type="text/javascript"> console.log('Hello, world!'); </script> <?php \shqear\widgets\Embedjs::end(); ?>