Yii2 Tools
The preferred way to install this extension is through composer.
Either run
php composer.phar require deesoft/yii2-tools "~1.0"
or add
"deesoft/yii2-tools": "~1.0"
to the require section of your composer.json
file.
Define event handler in self class.
class User extends ActiveRecord
{
public function onBeforeSave($event)
{
// execute at event beforeSave
// do someting
}
public function behaviors()
{
return [
'dee\tools\AutoHandlerBehavior',
];
}
}
Save information of client(browser).
// config
'components' => [
...
'profile' => 'dee\tools\State',
]
// this information is unique per client.
Yii::$app->profile->address = 'Jl. Buntu No 3426 Lamongan';
echo Yii::$app->profile->address;