Yii2 audit record and database changes details

Installs: 271

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2020-01-17 09:18 UTC

This package is auto-updated.

Last update: 2024-11-17 20:35:18 UTC


README

Yii2 audit record and database changes details

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist mehulpatel/vspl:"dev-master"

or

php composer.phar require --prefer-dist mehulpatel/vspl:"dev-master"

or add

"mehulpatel/vspl": "dev-master"

to the require section of your composer.json file.

Migration or Table
you need to import "audit_entry.sql" directly in your DB.
Module

Add Audit Entry module in your config file

....
'modules' => [
    ......
    'auditlog' => [
                'class' => 'mehulpatel\mod\audit\AuditEntryModule'
    ],
    ......
],
....
Component

Add DateTimeHelper components in your config file

....
'components' => [
    ......
    'dateTimeConversion' => [
                'class' => 'mehulpatel\mod\audit\components\DateTimeHelper'
    ],
    ......
],
....

Usage

Use get audit log activities or records, attached "AuditEntryBehaviors" with your models as belows:

use mehulpatel\mod\audit\behaviors\AuditEntryBehaviors;
use yii\db\ActiveRecord;

class User extends ActiveRecord {

    public function behaviors(){
        return [ 
            ....
            'auditEntryBehaviors' => [
                'class' => AuditEntryBehaviors::class
             ],
             ....
        ];
    }
}