Download the PHP package codyas/audit-bundle without Composer
On this page you can find all versions of the php package codyas/audit-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codyas/audit-bundle
More information about codyas/audit-bundle
Files in codyas/audit-bundle
Package audit-bundle
Short Description Keep a changelog of Doctrine entities using Serializer component
License MIT
Informations about the package audit-bundle
Codyas Audit Bundle
Codyas Audit is a Symfony bundle that allows tracking changes to Doctrine entities. It is specifically designed to track changes from one or more master classes, in such a way that when changes are detected in any of the related (and previously configured) entities, the changes are serialized from the master class and the revision is created in the database.
Features
- Changes are detected and handled using the Doctrine Lifecycle Subscribers.
- Allows customized serialization of the entities, that later are stored in the revision index when the audit is triggered.
- Compute difference between audits.
- Revisions are stored using compression.
- Changes are computed after the request is completed and the response was sent to the user.
Requirements
- PHP >= 8.1
- Symfony >= 5.0
Installation
First your need to allow extra contrib to configure the bundle via Flex, run the following in your project root:
Then install the bundle:
Configuration
Most of the project config should be done by Flex. If due to any reason the configuration isn't automatically done, configure the bundle manually:
Register the bundle:
Configure the bundle:
Register the Doctrine compressed data type
Concepts
- Master entity: The entity that will be used as serialization root when a data change is detected either in the master entity or in any of it related entities.
- Slave entity: Entities that have a dependant relationship to the master entity. The relation with the master class doesn't need to be direct, as changes in entities with any degree of relationship with the master entity can also be detected and handled.
- Auditable entity: An entity that does not follows the master-slave approach and you want to keep a changelog of its data.
Usage
In a master entity you must implement the interfaces AuditableInterface
and MasterAuditableInterface
as well as enable and define
the serialization groups on the fields you want to store in the revisions. By default, the serialization group is audit
but you can
override this in bundle settings.
In a slave entity you must configure the serialization groups and implement AuditableInterface
and SlaveAuditableInterface
. Finally, you need to implement
getMaster()
and getMasterNamespace()
methods, returning respectively the master entity instance and namespace.
All versions of audit-bundle with dependencies
ext-zlib Version *
symfony/orm-pack Version ^1.0 || 2.0
symfony/framework-bundle Version ^5.0 || ^6.0
knplabs/knp-paginator-bundle Version ^5.0
symfony/flex Version ^1.0 || ^2.0
symfony/serializer Version ^5.0 || ^6.0
swaggest/json-diff Version ^3.10