PHPackages                             dereuromark/cakephp-audit-stash - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. dereuromark/cakephp-audit-stash

ActiveCakephp-plugin[Logging &amp; Monitoring](/categories/logging)

dereuromark/cakephp-audit-stash
===============================

Flexible and rock solid audit log tracking plugin for cakephp

1.0.0(2mo ago)55.7k↓14.8%[2 issues](https://github.com/dereuromark/cakephp-audit-stash/issues)1MITPHPPHP &gt;=8.2CI passing

Since Oct 15Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/dereuromark/cakephp-audit-stash)[ Packagist](https://packagist.org/packages/dereuromark/cakephp-audit-stash)[ RSS](/packages/dereuromark-cakephp-audit-stash/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (17)Versions (18)Used By (1)

AuditStash Plugin For CakePHP
=============================

[](#auditstash-plugin-for-cakephp)

[![Build Status](https://github.com/dereuromark/cakephp-audit-stash/actions/workflows/ci.yml/badge.svg)](https://github.com/dereuromark/cakephp-audit-stash/actions/workflows/ci.yml)[![Coverage Status](https://camo.githubusercontent.com/9e8a11d34734de59d21eef449df0c7bfd1c679123fe5646893cc1e8ada1103e3/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6465726575726f6d61726b2f63616b657068702d61756469742d73746173682f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/dereuromark/cakephp-audit-stash)[![PHPStan](https://camo.githubusercontent.com/f60d96f7c2579690ab6dfa8918f777fe93a02a92301c661eb38a85861a92b780/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d627269676874677265656e2e7376673f7374796c653d666c6174)](https://phpstan.org/)[![Latest Stable Version](https://camo.githubusercontent.com/badfa6961a435b9659574a1cbf2b34cc6b1f7f7351205681f7c32dcac500a27a/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d61756469742d73746173682f762f737461626c652e737667)](https://packagist.org/packages/dereuromark/cakephp-audit-stash)[![Minimum PHP Version](https://camo.githubusercontent.com/ec21f169d70b69344c67d6f18fa1a24d20476d2f0cd680e8c4a1534c22f34e5f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230382e322d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/3dbb6addd1c228fefcedfb242d2007f837484c51d0e04c5f69341b037b5d967d/68747470733a2f2f706f7365722e707567782e6f72672f6465726575726f6d61726b2f63616b657068702d61756469742d73746173682f642f746f74616c2e737667)](https://packagist.org/packages/dereuromark/cakephp-audit-stash)

This plugin implements an "audit trail" for any of your Table classes in your application, that is, the ability of recording any creation, modification or delete of the entities of any particular table.

By default, this plugin stores audit logs in a database table using the CakePHP ORM. The plugin also includes:

- Built-in UI for browsing and searching audit logs
- Real-time monitoring and alerting system
- Configurable retention policies with automated cleanup
- Optional Elasticsearch support for high-volume applications

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

[](#installation)

Install via [composer](https://getcomposer.org):

```
composer require dereuromark/cakephp-audit-stash
bin/cake plugin load AuditStash
```

Run the migrations to create the `audit_logs` table:

```
bin/cake migrations migrate -p AuditStash
```

Quick Start
-----------

[](#quick-start)

Enable audit logging in any Table class by adding the behavior:

```
class ArticlesTable extends Table
{
    public function initialize(array $config): void
    {
        parent::initialize($config);
        $this->addBehavior('AuditStash.AuditLog');
    }
}
```

Optionally, track the current user and request info in `AppController`:

```
use AuditStash\Meta\RequestMetadata;
use Cake\Event\EventManager;

public function beforeFilter(EventInterface $event)
{
    parent::beforeFilter($event);

    EventManager::instance()->on(
        new RequestMetadata(
            request: $this->getRequest(),
            user: $this->getRequest()->getAttribute('identity')?->getIdentifier(),
        ),
    );
}
```

That's it! Your application is now tracking all creates, updates, and deletes.

Features
--------

[](#features)

### Audit Log Viewer

[](#audit-log-viewer)

Browse and search audit logs through a built-in web interface at `/admin/audit-logs`:

- Filter by table, user, event type, date range, transaction ID
- View detailed before/after comparisons with inline or side-by-side diff
- Timeline view showing complete history for specific records
- Export to CSV or JSON

See [Viewer Documentation](docs/viewer.md) for details.

### Monitoring &amp; Alerting

[](#monitoring--alerting)

Real-time monitoring system that detects suspicious activities:

- Mass deletion detection
- Off-hours activity monitoring
- Customizable rules and notification channels (email, webhook, logs)
- Extensible architecture for custom rules

See [Monitoring Documentation](docs/monitoring.md) for setup.

### Log Retention &amp; Cleanup

[](#log-retention--cleanup)

Automated cleanup with configurable retention policies:

- Table-specific retention periods
- Command-line tool for manual or automated cleanup
- Cron-friendly with dry-run support

See [Retention Documentation](docs/retention.md) for configuration.

### Flexible Storage

[](#flexible-storage)

- **Database (default)**: Simple, fast, works out-of-the-box
- **Elasticsearch**: Optional for high-volume applications
- **Custom**: Implement your own persister

See [Configuration Documentation](docs/configuration.md) for storage options.

Documentation
-------------

[](#documentation)

- **[Configuration](docs/configuration.md)** - Database and Elasticsearch setup, persister options
- **[Usage](docs/usage.md)** - Behavior configuration, metadata tracking, custom persisters
- **[Viewer](docs/viewer.md)** - Web UI for browsing and searching audit logs
- **[Retention](docs/retention.md)** - Automated log cleanup and retention policies
- **[Monitoring](docs/monitoring.md)** - Real-time alerting for suspicious activities

Demo
----

[](#demo)

Related Plugins
---------------

[](#related-plugins)

If you need to moderate or approve changes **before** they happen (rather than auditing them after), check out the [Bouncer plugin](https://github.com/dereuromark/cakephp-bouncer). While AuditStash tracks what has already been changed, Bouncer provides approval workflows and change moderation before changes are persisted.

Testing
-------

[](#testing)

Run the test suite:

```
vendor/bin/phpunit
```

For Elasticsearch tests, set the environment variable:

```
elastic_dsn="Cake\ElasticSearch\Datasource\Connection://127.0.0.1:9200?driver=Cake\ElasticSearch\Datasource\Connection" vendor/bin/phpunit
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance81

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~10 days

Recently: every ~1 days

Total

16

Last Release

60d ago

Major Versions

0.3.12 → 1.0.02026-03-19

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39854?v=4)[Mark Scherer](/maintainers/dereuromark)[@dereuromark](https://github.com/dereuromark)

---

Top Contributors

[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (126 commits)")[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (107 commits)")[![cnizzardini](https://avatars.githubusercontent.com/u/171294?v=4)](https://github.com/cnizzardini "cnizzardini (11 commits)")[![jippi](https://avatars.githubusercontent.com/u/22841?v=4)](https://github.com/jippi "jippi (9 commits)")[![nicosp](https://avatars.githubusercontent.com/u/4110066?v=4)](https://github.com/nicosp "nicosp (8 commits)")[![swiffer](https://avatars.githubusercontent.com/u/2990373?v=4)](https://github.com/swiffer "swiffer (6 commits)")[![bravo-kernel](https://avatars.githubusercontent.com/u/230500?v=4)](https://github.com/bravo-kernel "bravo-kernel (6 commits)")[![amayer5125](https://avatars.githubusercontent.com/u/3212673?v=4)](https://github.com/amayer5125 "amayer5125 (3 commits)")[![aceat64](https://avatars.githubusercontent.com/u/348675?v=4)](https://github.com/aceat64 "aceat64 (2 commits)")[![blamh](https://avatars.githubusercontent.com/u/114339?v=4)](https://github.com/blamh "blamh (1 commits)")[![harikt](https://avatars.githubusercontent.com/u/120454?v=4)](https://github.com/harikt "harikt (1 commits)")[![HridayTaneja](https://avatars.githubusercontent.com/u/19855146?v=4)](https://github.com/HridayTaneja "HridayTaneja (1 commits)")[![CauanCabral](https://avatars.githubusercontent.com/u/83092?v=4)](https://github.com/CauanCabral "CauanCabral (1 commits)")[![medero](https://avatars.githubusercontent.com/u/29695?v=4)](https://github.com/medero "medero (1 commits)")[![ajibarra](https://avatars.githubusercontent.com/u/794722?v=4)](https://github.com/ajibarra "ajibarra (1 commits)")[![arusinowski](https://avatars.githubusercontent.com/u/1587389?v=4)](https://github.com/arusinowski "arusinowski (1 commits)")[![bmudda](https://avatars.githubusercontent.com/u/1568534?v=4)](https://github.com/bmudda "bmudda (1 commits)")

---

Tags

pluginloggingcakephptrackingAudithistoryadmin-panel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dereuromark-cakephp-audit-stash/health.svg)

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

###  Alternatives

[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[lordsimal/cakephp-sentry

Sentry plugin for CakePHP

12270.3k](/packages/lordsimal-cakephp-sentry)[dereuromark/cakephp-databaselog

A CakePHP plugin for storing and viewing application logs in the database

44165.0k2](/packages/dereuromark-cakephp-databaselog)[betapeak/laravel-auditing-filesystem

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

166.5k](/packages/betapeak-laravel-auditing-filesystem)

PHPackages © 2026

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