deesoft / yii2-tools
Yii2 application tools
Installs: 465
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- yiisoft/yii2: ~2.0.0
This package is not auto-updated.
Last update: 2024-11-18 07:58:51 UTC
README
Yii2 Tools
Installation
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.
AutoHandlerBehavior
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', ]; } }
State
Save information of client(browser).
// config 'components' => [ ... 'profile' => 'dee\tools\State', ]
Usage
// this information is unique per client. Yii::$app->profile->address = 'Jl. Buntu No 3426 Lamongan'; echo Yii::$app->profile->address;