mirko-pagliai / cakephp-entities-logger
Entities Logger plugin for CakePHP
Installs: 28
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=8.1
- cakephp/cakephp: ^5.0.3
- cakephp/chronos: ^3.1
- cakephp/migrations: ^4.5
Requires (Dev)
- cakedc/cakephp-phpstan: ^4.0
- cakephp/cakephp-codesniffer: ^5.2
- mockery/mockery: ^1.6
- phpunit/phpunit: ^10.5.5 || ^11.1.3 || ^12.0.9
This package is auto-updated.
Last update: 2025-06-27 21:30:26 UTC
README
From this screenshot, which shows the table seen by PhpMyAdmin, we see the logs generated by two different entities, created, modified or deleted by different users.
Installation
You can install the plugin via composer:
composer require --prefer-dist mirko-pagliai/cakephp-entities-logger
Then you have to load the plugin. For more information on how to load the plugin, please refer to the CakePHP documentation.
Simply, you can execute the shell command to enable the plugin:
bin/cake plugin load Cake/EntitiesLogger
This would update your application's bootstrap method.
Create the table
Now you need to create the table that the plugin will use to keep changes to the entities you want.
The best way is using migrations:
bin/cake migrations migrate -p Cake/EntitiesLogger
Instead, if you want to verify that the plugin migrations have been applied correctly:
bin/cake migrations status -p Cake/EntitiesLogger
Add the behavior
Add the Cake/EntitiesLogger.EntitiesLog
behavior to the tables you want.
Inside the initialize()
method of your tables:
namespace App\Model\Table; use Cake\ORM\Table; class ArticlesTable extends Table { public function initialize(array $config): void { // ... $this->addBehavior('Cake/EntitiesLogger.EntitiesLog'); // ... } }