jansuchanek/naudit

Doctrine entity audit log for Nette — automatic change tracking with user context

Maintainers

Package info

github.com/JanSuchanek/naudit

pkg:composer/jansuchanek/naudit

Statistics

Installs: 2

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-03-20 14:34 UTC

This package is auto-updated.

Last update: 2026-04-20 15:26:23 UTC


README

Doctrine entity audit log for Nette Framework — automatically tracks changes to entities.

Features

  • 📝 Change Tracking — Records create/update/delete with field diffs
  • 🔌 AuditableInterface — Mark entities for tracking
  • 📊 JSON Storage — Changes stored as JSON in audit_log table
  • ⚙️ DI Extension — Auto-registers Doctrine event subscriber

Installation

composer require jansuchanek/naudit

Configuration

extensions:
    audit: NAudit\DI\NAuditExtension

Usage

Implement AuditableInterface on your entities:

use NAudit\AuditableInterface;

class Product implements AuditableInterface
{
    use AuditableTrait;

    public function getAuditLabel(): string
    {
        return $this->name;
    }
}

Migration

CREATE TABLE audit_log (
    id INT AUTO_INCREMENT PRIMARY KEY,
    entity_class VARCHAR(255) NOT NULL,
    entity_id INT NOT NULL,
    action VARCHAR(16) NOT NULL,
    changes JSON,
    user_id INT,
    created_at DATETIME NOT NULL,
    INDEX idx_entity (entity_class, entity_id)
);

Requirements

  • PHP >= 8.2
  • Doctrine ORM ^3.0
  • Nette DI ^3.2

License

MIT