Skip to content

About

Symfony + Doctrine bundle for automatic created/updated timestamps and blame fields on opt-in entities.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

100 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Audit Kit Bundle

CI Packagist Version Packagist Downloads License PHP Symfony GitHub stars Coverage

⭐ Found this useful? Install from Packagist and give the repo a star on GitHub.

Symfony + Doctrine bundle for automatic auditing fields on any opt-in entity:

Field Set on
createdAt / updatedAt prePersist + preUpdate (timestamps only on update)
createdBy / updatedBy When an authenticated user is present (nullable in CLI)
Complements nowo-tech/user-kit-bundle (account state / presence) and nowo-tech/auth-kit-bundle (auth flows).

FrankenPHP Friendly Worker Mode

This bundle is FrankenPHP worker mode friendly, including the strict case where the kernel is not reset between requests. See docs/FRANKENPHP-WORKER-AUDIT.md.

Features

  • Optional traits: TimestampableTrait, BlameableTrait, AuditableTrait
  • Public opaque UUID: PublicUuidInterface + PublicUuidTrait, filled on prePersist by PublicUuidListener (UUID v7)
  • Append-only CreatedAtImmutableTrait (non-null createdAt)
  • SqlLike helper: escape LIKE input with an ESCAPE '\' clause that behaves the same on MySQL and SQLite
  • SqlFulltext helper: DQL text search with MySQL / MariaDB FULLTEXT (MATCH … AGAINST boolean prefix query, InnoDB token rules) and an escaped LIKE fallback elsewhere, plus result snippets
  • KeysetDelete helper: delete matching rows in short primary-key batches (portable DBAL, keyset over the id)
  • Doctrine entity listener (prePersist / preUpdate)
  • Action log (opt-in): AbstractActionLog mapped superclass, ActionLogRecorder, filterable repository with keyset purge, nowo:audit-kit:action-log:purge and an optional Twig timeline — maps onto existing tables with no migration
  • Named profiles — separate field mapping and flags per user entity (User, Admin, …) with O(1) class resolution
  • Configurable property names and user_class
  • Per-entity opt-out via #[Auditable(enabled: false)]
  • Guest / CLI safe — blame fields stay null without errors

Quick start

composer require nowo-tech/audit-kit-bundle
# config/packages/nowo_audit_kit.yaml
nowo_audit_kit:
    default_profile: default
    profiles:
        default:
            user_class: App\Entity\User

The legacy flat layout (user_class at root) remains supported. See Configuration.

use Nowo\AuditKitBundle\Model\AuditableTrait;

class Article
{
    use AuditableTrait;
}

Requirements

  • PHP 8.2+
  • Symfony 7.4 | 8.x
  • Doctrine ORM 2.15+ | 3.x

Demo

make -C demo/symfony8 up   # http://localhost:8013 (default PORT)

Each demo persists entities with automatic audit columns (see demo/symfony8/src/Entity/Article.php and LegacyRecord.php for audited vs opt-out). See demo/symfony8/README.md and docs/DEMO-FRANKENPHP.md for FrankenPHP setup (including worker mode for production).

Development

make up
make test-coverage
make release-check

Documentation

Additional documentation

Tests and coverage

  • Tests: PHPUnit (unit + integration)
  • PHP: 100%
  • TS/JS: N/A
  • Python: N/A

Compatibility: PHP 8.2+ · Symfony 7.4 / 8.0 / 8.1 (CI matrix).

License

MIT — see LICENSE.

Package

  • Composer: nowo-tech/audit-kit-bundle
  • Config root: nowo_audit_kit

About

Symfony + Doctrine bundle for automatic created/updated timestamps and blame fields on opt-in entities.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages