mdmsoft/yii2-prototype

Prototype emulator for yii2 component

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 1

Open Issues: 0

Type:yii2-extension

dev-master / 1.x-dev 2018-10-09 08:54 UTC

This package is not auto-updated.

Last update: 2024-11-14 13:40:29 UTC


README

Prototype emulator for Yii2 component

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist mdmsoft/yii2-prototype "~1.0"

or add

"mdmsoft/yii2-prototype": "~1.0"

to the require section of your composer.json file.

Usage

Yii::$app->attachBehavior(0,\mdm\prototype\Prototype::className());

Yii::$app->prototype->x = 1;
echo Yii::$app->x; // 1
Yii::$app->x = 'seratus';
echo Yii::$app->x; // 'seratus'

Yii::$app->prototype->z = function($var){
    echo $var;
};

Yii::$app->z('Hello cak');
 
Yii::$app->prototype->getSomething = function(){
    return 'something';
};

Yii::$app->something;