PHPackages                             data-dog/audit-bundle - 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. [Database &amp; ORM](/categories/database)
4. /
5. data-dog/audit-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

data-dog/audit-bundle
=====================

Audit bundle for symfony2 and doctrine orm, logs any database change

v1.2.2(3mo ago)141901.7k↑17.5%68[19 issues](https://github.com/DATA-DOG/DataDogAuditBundle/issues)[1 PRs](https://github.com/DATA-DOG/DataDogAuditBundle/pulls)1MITPHPPHP &gt;=8.1CI passing

Since Aug 11Pushed 3mo ago13 watchersCompare

[ Source](https://github.com/DATA-DOG/DataDogAuditBundle)[ Packagist](https://packagist.org/packages/data-dog/audit-bundle)[ Docs](https://github.com/DATA-DOG/DataDogAuditBundle)[ RSS](/packages/data-dog-audit-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (32)Used By (1)

Audit Bundle
============

[](#audit-bundle)

This bundle creates an audit log for all Doctrine ORM database related changes:

- Inserts and updates including their diffs and relation field diffs.
- Many to many relation changes, association and dissociation actions.
- If there is a user in token storage, they will be linked to the log.
- The audit entries are inserted within the same transaction during **flush**, if something fails the state remains clean.

Basically you can track any change from these log entries if they were managed through standard **ORM** operations.

**NOTE:** audit cannot track DQL or direct SQL updates or delete statement executions.

Install
-------

[](#install)

First, install it with composer:

```
composer require data-dog/audit-bundle
```

Then, add it in your bundles.

```
// config/bundles.php
return [
    ...
    DataDog\AuditBundle\DataDogAuditBundle::class => ['all' => true],
    ...
];
```

Finally, create the database tables used by the bundle:

Using [Doctrine Migrations Bundle](https://symfony.com/bundles/DoctrineMigrationsBundle/current/index.html):

```
php app/console doctrine:migrations:diff
php app/console doctrine:migrations:migrate
```

Using Doctrine Schema:

```
php app/console doctrine:schema:update --force
```

Usage
-----

[](#usage)

**audit** entities will be mapped automatically if you run schema update or similar. And all the database changes will be reflected in the audit log afterwards.

### Unaudited Entities (deprecated, use `entities`)

[](#unaudited-entities-deprecated-use-entities)

Sometimes, you might not want to create audit log entries for particular entities. You can achieve this by listing those entities under the `unaudited_entities` configuration key in your `config.yml`, for example:

```
data_dog_audit:
    unaudited_entities:
        - App\Entity\NoAuditForThis
```

### Specify Audited Entities (deprecated, use `entities`)

[](#specify-audited-entities-deprecated-use-entities)

Sometimes, it is also possible, that you want to create audit log entries only for particular entities. You can achieve it quite similar to unaudited entities. You can list them under the `audited_entities`configuration key in your `config.yml`, for example:

```
data_dog_audit:
    audited_entities:
        - App\Entity\AuditForThis
```

You can specify either audited or unaudited entities. If both are specified, only audited entities would be taken into account.

### Specify Audited Entities with specific fields (extends version)

[](#specify-audited-entities-with-specific-fields-extends-version)

The new configuration has been expanded with fields that can be set as excluded or highlighted.

```
class Test {
    private string $name;
    private bool $noImportant;
    private \DateTime $createdAt;
    private \DateTime $modifiedAt;
}
```

When we only want to audit a few fields:

```
data_dog_audit:
    entities:
        App\Entity\Test:
            mode: include
            fields:
                - name
                - createdAt
                - modifiedAt
```

OR

```
data_dog_audit:
    entities:
        App\Entity\Test:
            mode: exclude
            fields:
                - noImportant
```

The old logic was also included in the new configuration:

If we want to audit everything on an entity

```
data_dog_audit:
    entities:
        App\Entity\Test:
            mode: include
            fields: ~
```

If we want to exclude an entity

```
data_dog_audit:
    entities:
        App\Entity\Test:
            mode: exclude
            fields: ~
```

### Impersonation

[](#impersonation)

Sometimes, you might also want to blame the `impersonator` user instead of the `impersonated` one. You can archive this by adding the `blame_impersonator` configuration key in your `config.yml`, for example:

```
    data_dog_audit:
        blame_impersonator: true
```

The default behavior is to blame the logged-in user, so it will ignore the `impersonator` when not explicitly declared.

Clean up old logs
-----------------

[](#clean-up-old-logs)

To clean up old logs, use the following command:

`bin/console audit-logs:delete-old-logs --retention-period=P6M`

You can specify `retention-period`, For format, see:

License
-------

[](#license)

The audit bundle is free to use and is licensed under the [MIT license](https://opensource.org/licenses/mit-license.php)

###  Health Score

66

—

FairBetter than 99% of packages

Maintenance77

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

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

Recently: every ~181 days

Total

31

Last Release

108d ago

Major Versions

v0.1.x-dev → v1.0.02024-02-04

PHP version history (3 changes)v0.1.0PHP &gt;=5.4.0

v0.1.21PHP &gt;=7.4

v1.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b007520624bae09a9b2c11dc14b6c0f176b8d08456f84dcf3111a3a262ed29a?d=identicon)[l3pp4rd](/maintainers/l3pp4rd)

---

Top Contributors

[![indjeto](https://avatars.githubusercontent.com/u/4854116?v=4)](https://github.com/indjeto "indjeto (41 commits)")[![l3pp4rd](https://avatars.githubusercontent.com/u/132389?v=4)](https://github.com/l3pp4rd "l3pp4rd (40 commits)")[![chancegarcia](https://avatars.githubusercontent.com/u/348263?v=4)](https://github.com/chancegarcia "chancegarcia (6 commits)")[![krzysztofruszczynski](https://avatars.githubusercontent.com/u/9629651?v=4)](https://github.com/krzysztofruszczynski "krzysztofruszczynski (4 commits)")[![andreasferber](https://avatars.githubusercontent.com/u/4956110?v=4)](https://github.com/andreasferber "andreasferber (3 commits)")[![dozsan](https://avatars.githubusercontent.com/u/6186179?v=4)](https://github.com/dozsan "dozsan (3 commits)")[![marco-mdl](https://avatars.githubusercontent.com/u/33692435?v=4)](https://github.com/marco-mdl "marco-mdl (3 commits)")[![teladocdozsan](https://avatars.githubusercontent.com/u/257991871?v=4)](https://github.com/teladocdozsan "teladocdozsan (3 commits)")[![mix6s](https://avatars.githubusercontent.com/u/6933381?v=4)](https://github.com/mix6s "mix6s (2 commits)")[![vytautas-k](https://avatars.githubusercontent.com/u/10547406?v=4)](https://github.com/vytautas-k "vytautas-k (2 commits)")[![stefanogironella](https://avatars.githubusercontent.com/u/6747447?v=4)](https://github.com/stefanogironella "stefanogironella (2 commits)")[![matthieuJonqet](https://avatars.githubusercontent.com/u/138498669?v=4)](https://github.com/matthieuJonqet "matthieuJonqet (1 commits)")[![max-kovpak](https://avatars.githubusercontent.com/u/8402366?v=4)](https://github.com/max-kovpak "max-kovpak (1 commits)")[![Mopster](https://avatars.githubusercontent.com/u/155956?v=4)](https://github.com/Mopster "Mopster (1 commits)")[![ndench](https://avatars.githubusercontent.com/u/2062388?v=4)](https://github.com/ndench "ndench (1 commits)")[![phryneas](https://avatars.githubusercontent.com/u/4282439?v=4)](https://github.com/phryneas "phryneas (1 commits)")[![stevro](https://avatars.githubusercontent.com/u/4375675?v=4)](https://github.com/stevro "stevro (1 commits)")[![elmar-roeser](https://avatars.githubusercontent.com/u/161482869?v=4)](https://github.com/elmar-roeser "elmar-roeser (1 commits)")[![jonathanstidwillvf](https://avatars.githubusercontent.com/u/14923116?v=4)](https://github.com/jonathanstidwillvf "jonathanstidwillvf (1 commits)")[![jf2s](https://avatars.githubusercontent.com/u/39997917?v=4)](https://github.com/jf2s "jf2s (1 commits)")

---

Tags

logbundleormdoctrineSymfony2Audit

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/data-dog-audit-bundle/health.svg)

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

###  Alternatives

[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[data-dog/pager-bundle

Paginator bundle for symfony2 and doctrine orm, allows customization with filters and sorters

11103.5k7](/packages/data-dog-pager-bundle)

PHPackages © 2026

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