PHP code example of sateler / yii2-changelog

1. Go to this page and download the library: Download sateler/yii2-changelog 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/ */

    

sateler / yii2-changelog example snippets


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

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

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]);
            },
        ]
    ],
];

php composer.phar