data-dog/audit-bundle
Doctrine ORM audit logging bundle for Symfony that records inserts, updates, diffs, and many-to-many relation changes in the same transaction as flush, links entries to the token storage user, and supports per-entity and per-field include/exclude config.
audited_entities and unaudited_entities") by a first-time contributor. This is nominally a patch release, but it is a behavioural change, not a cosmetic one: the bundle's inclusion/exclusion configuration is now actually applied.audited_entities) or a deny-list (unaudited_entities) were, in practice, getting audit coverage driven by something other than that configuration. After upgrading, coverage is driven by the configuration as written. The set of audited entities can change on a patch upgrade without any application code change.Unaudited Entities as a deprecated feature to be replaced. That was wrong — it is an active configuration surface that was simply not being honoured. The remediation is an upgrade plus a config audit, not a replacement plan.audited_entities / unaudited_entities become the primary lever for scoping audit coverage. This strengthens the architectural fit for Laravel apps that need a selective audit trail (audit business-critical models, exclude high-churn or PII-heavy tables) — but it also means the config file is now an audit-policy document that must be reviewed and owned, not a default left untouched.DB::transaction()) but may introduce performance overhead if audit logging is disabled mid-transaction.TokenStorage for user attribution. In Laravel, this would require mapping to Laravel's Auth system (e.g., via middleware or service providers).DB::listen() or query loggers) for full coverage. Note that v1.3.2 widens this gap in perception: a correctly configured allow-list now gives a false sense of completeness — "we configured our audited entities" does not mean "we audit our data changes."TokenStorage) to be bridged (e.g., via symfony/http-foundation or custom wrappers).audit_entry, audit_entity, etc.). Laravel's migrations system can adopt these, but schema changes must be backward-compatible.flush, which could impact write-heavy operations. v1.3.2 is performance-relevant: correctly applied unaudited_entities is now a legitimate lever for removing audit write load from high-churn tables. Benchmarking is recommended for high-throughput systems.audited_entities was configured as a whitelist while the option was ignored, everything was being logged; post-upgrade only the whitelist is. That is a retroactive compliance gap — records the organisation believed it had will simply not be written going forward, with no error, warning, or log line. Conversely, a previously-ignored unaudited_entities deny-list means sensitive or high-volume tables may have been captured in audit tables all along (data-protection exposure in existing rows) and will stop being captured now.v1.3.2 is the version resolved by Composer, and compatibility with Laravel 10.x/Symfony 6.x+. The presence of a real changelog resolves the "abandoned" concern but not the "is this the version we pinned" concern.TokenStorage ≠ Laravel's Auth. Requires custom mapping.eloquent.*) won't trigger Doctrine listeners by default.audited_entities / unaudited_entities, and is that list traceable to a stated audit policy? Is the config currently a placeholder?TokenStorage?retrieved, saved, deleted events). The v1.3.2 config honouring does not help here — it is meaningless without Doctrine entities.audit_entry rows).audited_entities and unaudited_entities to match the intended audit policy; reconcile against the as-is baseline and get sign-off from the compliance/security owner.composer require data-dog/audit-bundle:^1.3.2 (pin the minor; do not float the patch given the behavioural nature of patch releases here).config/app.php (Laravel) or config/bundles.php (Symfony):
// Laravel Service Provider (hypothetical)
DataDog\AuditBundle\DataDogAuditBundle::class,
php artisan doctrine:migrations:diff
php artisan doctrine:migrations:migrate
Schema::create('audit_entry', function (Blueprint $table) {
// Match bundle's schema
});
Auth::user() to Symfony's TokenStorage:
// Example: src/Providers/AuditServiceProvider.php
public function register()
{
$this->app->bind(\Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface::class, function () {
return new LaravelTokenStorage($this->app['auth']);
});
}
public function test_audit_logs_are_created()
{
$user = User::factory()->create();
$model = Model::factory()->create();
// Trigger an update...
$this->assertDatabaseHas('audit_entry', [
'entity_id' => $model->id,
'user_id' => $user->id,
]);
}
HttpFoundation, Security, and DoctrineBridge.symfony/http-foundation or symfony/security if not already present.DB::listen()). Add retention policies (e.g., TTL for old logs).composer update. Pin the version in composer.json.audited_entities / unaudited_entities must be in version control, code-reviewed on change, and reviewed on every package bump. Treat edits to this list as compliance-relevant changes.Unaudited Entities as deprecated — it is a supported, now-functional configuration option. Continue to track genuine deprecation warnings from the changelog.try-catch blocks may need adjustment to log failures before rollback.Auth → Symfony's TokenStorage.unaudited_entities list is now the first-line tool for reducing audit write amplification on high-churn tables — quantify the reduction rather than assuming it.entity_id, user_id).How can I help you explore Laravel packages today?