r2am9d/yii2-activity-log

A simplified yii2 module for tracking user web-based activities

dev-master 2021-06-04 17:37 UTC

This package is auto-updated.

Last update: 2024-04-05 00:03:49 UTC


README

993323

Yii2 Activity Log Module


A simplified Yii2 module for tracking user web-based activities

Installation

The preferred way to install this module is through composer:

Either run

php composer.phar require --prefer-dist r2am9d/yii2-activity-log

or add to the require-dev section of your composer.json file.

"r2am9d/yii2-activity-log": "*"

Once the extension is installed, simply add the lines below to your "modules" application configuration.

return [
    'modules' => [
        'activity-log' => [
            'class' => 'r2am9d\activitylog\Module',
        ],
    ],
];

Then add these lines to your "controllerMap" application configuration.

return [
    'controllerMap' => [
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationNamespaces' => [
                'r2am9d\activitylog\migrations',
            ],
        ],
    ],
];

Lastly, run the migrations.

~$ php yii migrate

Usage

Apply the custom behavior to your Controller or Model class via inherited "behaviors" function.

/**
 * {@inheritdoc}
 */
public function behaviors()
{
    return [
        \r2am9d\activitylog\behaviors\ActivityLogBehavior::className(),
    ];
}

Accessing module

You can then access the module through the following URL:

http://localhost/path/to/index?r=activity-log

or if you have enabled pretty URLs, you may use the following URL:

http://localhost/path/to/index/activity-log