PHP code example of xihrni / yii2-behavior-log

1. Go to this page and download the library: Download xihrni/yii2-behavior-log library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xihrni / yii2-behavior-log example snippets


yii migrate --migrationPath=@vendor/xihrni/yii2-behavior-log/migrations



namespace app\controllers;

use xihrni\yii2\behaviors\LogBehavior;

class IndexController extends \yii\web\Controller
{
    public function behaviors()
    {
        return array_merge(parent::behaviors(), [
            'log' => [
                'class' => LogBehavior::className(),
                'switchOn' => true,
                'role' => 'admin',
                'userBehaviorModel' => 'app\models\AdminBehaviorLog',
            ],
        ]);
    }
}