mazba / cake-simple-model-history
CakeSimpleModelHistory plugin for CakePHP (mazba.github.io)
Installs: 63
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Language:CSS
Type:cakephp-plugin
Requires
- php: >=5.5.9
- cakephp/cakephp: >=3.3.2 <4.0.0
Requires (Dev)
This package is not auto-updated.
Last update: 2025-04-21 16:16:18 UTC
README
Installation
You can install this plugin into your CakePHP application using composer.
Add the following lines to your application's composer.json
:
"require": { "mazba/cake-simple-model-history": "dev-master" }
followed by the command:
composer update
Or
The recommended way to install composer packages is:
composer require "mazba/cake-simple-model-history:dev-master"
Setup
In config/bootstrap.php
add:
Plugin::load('CakeSimpleModelHistory', ['bootstrap' => false, 'routes' => true]);
or using CakePHP's console:
./bin/cake plugin load CakeSimpleModelHistory
Configuration
Add the following line to your AppController:
use CakeSimpleModelHistory\Controller\ActivityLogsTrait;
Add the following inside your AppController Class
class AppController extends Controller { use ActivityLogsTrait; }
Finally, you'll also need to run migration on the package
cake migrations migrate -p CakeSimpleModelHistory
Attach the behavior in the models you want with:
public function initialize(array $config) { $this->addBehavior('CakeSimpleModelHistory.ActivityLogs'); }