atans/yii2-history

An active record history for yii2

Installs: 947

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 3

Forks: 0

Open Issues: 0

Type:yii2-extension

1.0.1 2017-03-30 09:52 UTC

This package is auto-updated.

Last update: 2024-04-13 22:26:20 UTC


README

An active record history extension for yii2

Installation

1.Download

The preferred way to install this extension is through composer.

Either run

composer require atans/yii2-history

or add

"atans/yii2-history": "*"

to the require section of your composer.json file.

Then run

composer update

2.Update database schema

$ php yii migrate/up --migrationPath=@vendor/atans/yii2-history/migrations

Usage

namespace frontend\models\User;

class User extends \yii\db\ActiveRecord
{
        /**
         * @inheritdoc
         */
        public function behaviors()
        {
            return [
                'history' => [
                    'class'      => \atans\history\behaviors\HistoryBehavior::className(),
                    
                    // Options
                    'allowEvents' => [..],
                    'ignoreFields' => [...],
                    'extraFields' => [...],
                    'debug' => true, // Show the errors
                ],
            ];
        }

}