PHPackages                             wedevelopnl/audit-scaffold - 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. wedevelopnl/audit-scaffold

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wedevelopnl/audit-scaffold
==========================

Scaffolding for creating Audit Logs in Symfony and Doctrine

2544PHP

Since Sep 9Pushed 1y ago6 watchersCompare

[ Source](https://github.com/wedevelopnl/audit-scaffold)[ Packagist](https://packagist.org/packages/wedevelopnl/audit-scaffold)[ RSS](/packages/wedevelopnl-audit-scaffold/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

WeDevelop Audit Scaffold
========================

[](#wedevelop-audit-scaffold)

**A boilerplate/scaffolding library for audit logs in your Symfony application, persistable to your database layer.**

### Motivation

[](#motivation)

Audit logging is the process of documenting *activity* within your application, with additional context such as: the responsible user/actor, the entry point to the application, the subject that was acted upon, and any other relevant domain logic for that activity. A series of audit logs is called an audit trail because it shows a sequential, chronological record of activity in your application.

Audit logs answer a simple question: who did what, to what, when and where?

> If your project is more interested in a historical log of how your data changed, rather than actions or activity, perhaps try [Loggable behaviour](https://github.com/doctrine-extensions/DoctrineExtensions/blob/main/doc/loggable.md "Loggable behavioral extension for Doctrine") for your entities and/or documents by [Doctrine Extensions](https://github.com/doctrine-extensions/DoctrineExtensions "Doctrine Extensions on GitHub").

Getting Started
---------------

[](#getting-started)

#### Requirements

[](#requirements)

- Symfony 7
- Doctrine persistence layer: either [ORM](https://packagist.org/packages/doctrine/orm "Doctrine ORM on Packagist")or [Mongo ODM](https://packagist.org/packages/doctrine/mongodb-odm "Mongo ODM on Packagist").

#### Installation

[](#installation)

This project is installed through Composer:

```
composer require "wedevelopnl/audit-scaffold"
```

### Limitations

[](#limitations)

This library does as much for you as it can, without knowing any of your application's domain or implementation logic.

> This library could hook itself into Symfony's bundle system but any modifications it would make within Symfony's configuration and container would purely be assumptions about how your application may or may not work.

While this library provides the base entity/document to extend from, and various DTOs, Enums and Value Objects, your application must implement the following:

- A single **Entity or Document** (including references to your user implementation, metadata such as table/collection name and indexes, and migration if applicable) implementing `AuditEntityInterface`.
- Service **container configuration**.
- Doctrine **mapping configuration**.
- **Translations** for whatever languages your application supports.
- and, of course, **audit classes** (that implement `AuditLogInterface`) for the things you want to audit in your application.

It is recommended that you extend from [`AbstractAuditEntity`](src/Entity/AbstractAuditEntity.php) and [`AbstractAuditLog`](src/AbstractAuditLog.php), which are provided for your convenience.

### Example Usage

[](#example-usage)

For a thorough explanation of the setup required to use this library with either Doctrine ORM or Mongo ODM, please refer to the [tutorial](docs/tutorial.md).

Example Audit Log```
