Download the PHP package herdwatch/entity-audit-bundle without Composer

On this page you can find all versions of the php package herdwatch/entity-audit-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package entity-audit-bundle

EntityAuditBundle

This extension for Doctrine 2 is inspired by Hibernate Envers and allows full versioning of entities and their associations.

Latest Stable Version Latest Unstable Version License

Total Downloads Monthly Downloads Daily Downloads

Branch Github Actions Code Coverage
1.x Test Coverage Status
master Test Coverage Status

Support

For general support and questions, please use StackOverflow.

If you think you found a bug or you have a feature idea to propose, feel free to open an issue after looking at the contributing guide.

License

This package is available under the LGPL license.

How does it work?

There are a bunch of different approaches to auditing or versioning of database tables. This extension creates a mirroring table for each audited entitys table that is suffixed with "_audit". Besides all the columns of the audited entity there are two additional fields:

The global revision table contains an id, timestamp, username and change comment field.

With this approach it is possible to version an application with its changes to associations at the particular points in time.

This extension hooks into the SchemaTool generation process so that it will automatically create the necessary DDL statements for your audited entities.

Installation

Installing the bundle

Simply run assuming you have composer:

Enable the bundle

Finally, enable the bundle in the kernel:

Configuration

Load extension "simple_things_entity_audit" and specify the audited entities

If you need to exclude some entity properties from triggering a revision use:

In order to work with other connection or entity manager than "default", use these settings:

Creating new tables

Call the command below to see the new tables in the update schema queue.

Installation (Standalone)

For standalone usage you have to pass the entity class names to be audited to the MetadataFactory instance and configure the two event listeners.

Usage

Querying the auditing information is done using a SimpleThings\EntityAudit\AuditReader instance.

In a standalone application you can create the audit reader from the audit manager:

Find entity state at a particular revision

This command also returns the state of the entity at the given revision, even if the last change to that entity was made in a revision before the given one:

Instances created through AuditReader#find() are NOT injected into the EntityManagers UnitOfWork, they need to be merged into the EntityManager if it should be reattached to the persistence context in that old version.

Find Revision History of an audited entity

A revision has the following API:

Find Changed Entities at a specific revision

A changed entity has the API:

Find Current Revision of an audited Entity

Setting the Current Username

Each revision automatically saves the username that changes it. For this to work, the username must be resolved.

In the Symfony web context the username is resolved from the one in the current security context token.

You can override this with your own behaviour by configuring the username_callable service in the bundle configuration. Your custom service must be a callable and should return a string or null.

In a standalone app or Symfony command you can set an username callable to a specific value using the AuditConfiguration.

Viewing auditing

A default Symfony controller is provided that gives basic viewing capabilities of audited data.

To use the controller, import the routing (don't forget to secure the prefix you set so that only appropriate users can get access)

This provides you with a few different routes:

TODOS


All versions of entity-audit-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
doctrine/collections Version ^1.6
doctrine/common Version ^3.1
doctrine/dbal Version ^2.13 || ^3.0
doctrine/event-manager Version ^1.1
doctrine/orm Version ^2.10
doctrine/persistence Version ^2.2 || ^3.0
symfony/config Version ^4.4 || ^5.4 || ^6.0
symfony/dependency-injection Version ^4.4 || ^5.4 || ^6.0
symfony/http-kernel Version ^4.4 || ^5.4 || ^6.0
symfony/security-core Version ^4.4 || ^5.4 || ^6.0
twig/twig Version ^2.6 || ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package herdwatch/entity-audit-bundle contains the following files

Loading the files please wait ....