2017 © Pedro Peláez
 

yii2-extension yii2-changelog

Yii2 behavior for storing model/table changelogs

image

sateler/yii2-changelog

Yii2 behavior for storing model/table changelogs

  • Monday, January 8, 2018
  • by rsateler
  • Repository
  • 2 Watchers
  • 0 Stars
  • 23 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 15 % Grown

The README.md

Yii2 behaviour for storing model/table changelogs

Installation

The preferred way to install this extension is through composer., (*1)

Either run, (*2)

php composer.phar require --prefer-dist sateler/yii2-changelog "^1.0"

or add, (*3)

"sateler/yii2-changelog": "^1.0"

to the require section of your composer.json file., (*4)

Once the extension is installed, add namespace to console config and run the required migration:, (*5)

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

./yii2 migrate, (*6)

Usage

Once installed, enable changelog for selected models by adding the following config to the model:, (*7)

public function behaviors()
{
    return [
        [
            'class' => \sateler\changelog\ChangeLogBehavior::className(),
            'ignore' => [], // ignore changes on listed columns
        ],
        ...
    ];
}

You can review the model changelog at http://hostname/changelog/, or you can code your own controller by using sateler\changelog\models\Changelog. If you want to 'see' the changelogs, add the following configuration and go to http://hostname/changelog/:, (*8)

return [
    'controllerMap' => [
        'changelog' => [
            'class' => 'sateler\changelog\controllers\ChangelogController',
            'viewPath' => '@vendor/sateler/yii2-changelog/views/changelog',
            // Optional: if set, it's used in the views to create the html link for the record.
            'urlCreator' => function ($table_name, $row_id) {
                $table_name = \yii\helpers\Html::encode(str_replace('_', '-', $table_name));
                return yii\helpers\Url::to(["$table_name/view", 'id' => $row_id]);
            },
        ]
    ],
];

Or you can code your own controller by using the sateler\changelog\models\Changelog model., (*9)

The Versions

08/01 2018

dev-master

9999999-dev

Yii2 behavior for storing model/table changelogs

  Sources   Download

MIT

The Requires

 

by Ricardo Sateler

extension yii2 changelog

08/01 2018

1.0.2

1.0.2.0

Yii2 behavior for storing model/table changelogs

  Sources   Download

MIT

The Requires

 

by Ricardo Sateler

extension yii2 changelog

03/01 2018

1.0.1

1.0.1.0

Yii2 behavior for storing model/table changelogs

  Sources   Download

MIT

The Requires

 

by Ricardo Sateler

extension yii2 changelog

02/01 2018

1.0.0

1.0.0.0

Yii2 behavior for storing model/table changelogs

  Sources   Download

MIT

The Requires

 

by Ricardo Sateler

extension yii2 changelog