PHPackages                             xintesa/audit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. xintesa/audit

ActiveCroogo-plugin[Utility &amp; Helpers](/categories/utility)

xintesa/audit
=============

Croogo Audit Plugin

1.2.0(11y ago)3122[1 issues](https://github.com/xintesa/Audit/issues)MITPHPPHP &gt;=5.3.0

Since May 16Pushed 9y ago7 watchersCompare

[ Source](https://github.com/xintesa/Audit)[ Packagist](https://packagist.org/packages/xintesa/audit)[ Docs](http://github.com/xintesa/Audit)[ RSS](/packages/xintesa-audit/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Audit Log Plugin
================

[](#audit-log-plugin)

A logging plugin for [CakePHP](http://cakephp.org). The included `AuditableBehavior` creates an audit history for each instance of a model to which it's attached.

The behavior tracks changes on two levels. It takes a snapshot of the fully hydrated object *after* a change is complete and it also records each individual change in the case of an update action.

Features
--------

[](#features)

- Support for CakePHP 2.0. Thanks, @jasonsnider.
- Tracks object snapshots as well as individual property changes.
- Allows each revision record to be attached to a source -- usually a user -- of responsibility for the change.
- Allows developers to ignore changes to specified properties. Properties named `created`, `updated` and `modified` are ignored by default, but these values can be overwritten.
- Handles changes to HABTM associations.
- Fully compatible with the [`PolymorphicBehavior`](http://bakery.cakephp.org/articles/view/polymorphic-behavior).
- Does not require or rely on the existence of explicit models revisions (`AuditLog`) and deltas (`AuditLogDeltas`).

Installation
------------

[](#installation)

### CakePHP &gt;= 2.0

[](#cakephp--20)

#### As an Archive

[](#as-an-archive)

1. Click the big ol' **Downloads** button next to the project description.
2. Extract the archive to `app/Plugin/AuditLog`.

#### As a Submodule

[](#as-a-submodule)

1. `$ git submodule add git://github.com/robwilkerson/CakePHP-Audit-Log-Plugin.git /app/Plugin/AuditLog`
2. `$ git submodule init`
3. `$ git submodule update`

To create tables you can use schema shell. To create tables execute:

```
cd /app/
chmod +x ./Console/cake
./Console/cake schema create --plugin AuditLog --name AuditLog

```

### CakePHP 1.3.x

[](#cakephp-13x)

For use with CakePHP 1.3.x, be sure to use code from the `1.3` branch and follow the instructions in that README file.

### Next Steps

[](#next-steps)

1. Run the `install.sql` file on your CakePHP application database. This will create the `audits` and `audit_deltas` tables that will store each object's relevant change history.
2. Create a `currentUser()` method, if desired.

    The `AuditableBehavior` optionally allows each changeset to be "owned" by a "source" -- typically the user responsible for the change. Since user and authentication models vary widely, the behavior supports a callback method that should return the value to be stored as the source of the change, if any.

    The `currentUser()` method must be available to every model that cares to track a source of changes, so I recommend that a copy of CakePHP's `app_model.php` file be created and the method added there. Keep it DRY, right?

    Storing the changeset source can be a little tricky if the core `Auth` component is being used since user data isn't readily available at the model layer where behaviors lie. One option is to forward that data from the controller. One means of doing this is to include the following code in `AppController::beforeFilter()`:

    ```
     if( !empty( $this->data ) && empty( $this->data[$this->Auth->userModel] ) ) {
       $this->data[$this->Auth->userModel] = $this->currentUser();
     }

    ```

    The behavior expects the `currentUser()` method to return an associative array with an `id` key. Continuing from the example above, the following code might appear in the `AppModel`:

    ```
     protected function currentUser() {
       $user = $this->Auth->user();

       return $user[$this->Auth->userModel]; # Return the complete user array
     }

    ```
3. Attach the behavior to any desired model and configure.

Usage
-----

[](#usage)

Applying the `AuditableBehavior` to a model is essentially the same as applying any other CakePHP behavior. The behavior does offer a few configuration options:

 `ignore` An array of property names to be ignored when records are created in the deltas table. `habtm` An array of models that have a HABTM relationship with the acting model and whose changes should be monitored with the model. If the HABTM model is auditable in its own right, don't include it here. This option is for related models whose changes are \_only\_ tracked relative to the acting model.### Syntax

[](#syntax)

```
# Simple syntax accepting default options
class Task extends AppModel {
  public $actsAs = array( 'AuditLog.Auditable' );

  #
  # Additional model code.
  #
}

# Syntax with explicit options
class Task extends AppModel {
  public $actsAs = array(
    'AuditLog.Auditable' => array(
      'ignore' => array( 'active', 'name', 'updated' ),
      'habtm'  => array( 'Type', 'Project' )
    )
  );

  #
  # Additional model code.
  #
}

```

Limitations
-----------

[](#limitations)

- The master branch is not backwards compatible with CakePHP &lt;=1.3.x. If you need compatibility with these version please install the code from the `1.3` branch and follow the instructions in that README.

License
-------

[](#license)

This code is licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).

Notes
-----

[](#notes)

Feel free to submit bug reports or suggest improvements in a ticket or fork this project and improve upon it yourself. Contributions welcome.

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~550 days

Total

3

Last Release

3328d ago

Major Versions

1.2.0 → 3.0.x-dev2017-05-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eb1110a1639e3f4cecf12c5ccbfd5aedf7c08d0feb336c1ba47fed959a70aea?d=identicon)[xintesa](/maintainers/xintesa)

![](https://www.gravatar.com/avatar/4fdafceeeb845e3e3afdbe939adb5001e81e0983e7345fc9bc6de112e6830f51?d=identicon)[rchavik](/maintainers/rchavik)

---

Top Contributors

[![rchavik](https://avatars.githubusercontent.com/u/39490?v=4)](https://github.com/rchavik "rchavik (37 commits)")[![robwilkerson](https://avatars.githubusercontent.com/u/7735?v=4)](https://github.com/robwilkerson "robwilkerson (32 commits)")[![jasonsnider](https://avatars.githubusercontent.com/u/209596?v=4)](https://github.com/jasonsnider "jasonsnider (14 commits)")[![yuanchavik](https://avatars.githubusercontent.com/u/8380742?v=4)](https://github.com/yuanchavik "yuanchavik (4 commits)")[![CpuID](https://avatars.githubusercontent.com/u/916201?v=4)](https://github.com/CpuID "CpuID (1 commits)")[![ptica](https://avatars.githubusercontent.com/u/169873?v=4)](https://github.com/ptica "ptica (1 commits)")

### Embed Badge

![Health badge](/badges/xintesa-audit/health.svg)

```
[![Health](https://phpackages.com/badges/xintesa-audit/health.svg)](https://phpackages.com/packages/xintesa-audit)
```

###  Alternatives

[fishpig/magento2-wordpress-integration-yoastseo

Magento 2 WordPress Inegration Addon module to support the WordPress SEO plugin by Yoast.

18198.8k](/packages/fishpig-magento2-wordpress-integration-yoastseo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
