2017 © Pedro Peláez
 

cakephp-plugin cakephp-auditor

Auditor plugin for CakePHP

image

angelxmoreno/cakephp-auditor

Auditor plugin for CakePHP

  • Thursday, March 1, 2018
  • by angelxmoreno
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 67 % Grown

The README.md

Auditor plugin for CakePHP

Requirements

* CakePHP 3.4.0+
* PHP 5.6+

Installation

You can install this plugin into your CakePHP application using composer., (*1)

The recommended way to install composer packages is:, (*2)

composer require angelxmoreno/cakephp-auditor

Then you need to apply two behaviors:, (*3)

  1. One on your UsersTable ( the Auditors )
$this->addBehavior('Auditor.Auditor');
  1. Another on your tables you with to track
$this->addBehavior('Auditor.Audit');

Options

For the AuditBehavior you have the following default options:, (*4)

[
    'attach'      => true,
    'reverse'     => false,
    'skip_fields' => [],
]

attach: Boolean ( default true)

Whether or not the behavior should attach the given table to the AuditsTable as a HasMany association, (*5)

reverse: Boolean ( default false)

Whether or not the behavior should attach the AuditsTable to the given table as a belongsTo association, (*6)

skip_fields: Array ( default empty array)

The fields that should be ignored when saving the diff of the previous and current fields., (*7)

[ It is recommended to add your created and modified fields], (*8)

Extras

I personally use a BaseTable and extend all my Table classes from that. It makes it easier to add traits, methods and other goodies to all my Table classes. I created a convenience method to conditionally add the Audit behavior when the Table class is not the AuditsTable. You can make use of it like so:, (*9)

\Auditor\Model\Behavior\AuditBehavior::makeAuditable($this, [
    'attach'      => false,
    'skip_fields' => ['modified', 'created'],
]);

License

Copyright 2018 Angel S. Moreno (angelxmoreno). All rights reserved., (*10)

Licensed under the MIT License. Redistributions of the source code included in this repository must retain the copyright notice found in each file., (*11)

The Versions

01/03 2018

dev-master

9999999-dev

Auditor plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

01/03 2018

1.0.2

1.0.2.0

Auditor plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

01/03 2018

1.0.1

1.0.1.0

Auditor plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires

01/03 2018

1.0.0

1.0.0.0

Auditor plugin for CakePHP

  Sources   Download

MIT

The Requires

 

The Development Requires