Download the PHP package xiidea/easy-audit without Composer
On this page you can find all versions of the php package xiidea/easy-audit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package easy-audit
Easy Audit
A Symfony Bundle To Log Selective Events. It is easy to configure and easy to customize for your need.
Versions
Symfony | PHP | EasyAuditBundle | Support |
---|---|---|---|
6.x | >=8.0.2 | 3.x.x | New Features / Bugs |
5.x | >=7.2.5 | 2.x.x | Bugs |
2.7-4.4 | ^5.6,^7.0 | 1.4.x | - |
<=2.8 | ^5.4-7.3 | 1.3.x | - |
<=2.4 | ^5.4 | 1.2.x | - |
Install
- Add EasyAuditBundle in your composer.json
- Enable the Bundle
- Create audit_log entity class
- Configure config.yml
- Update Database Schema
1. Add EasyAuditBundle in your composer.json
Add EasyAuditBundle in your composer.json:
Now tell composer to download the bundle by running the command:
Composer will install the bundle to your project's vendor/xiidea
directory.
2. Enable the Bundle
3. Create audit_log entity class
The XiideaEasyAuditBundle supports Doctrine ORM/MongoDB by default. However, you must provide a concrete AuditLog class. Follow the instructions to set up the class:
4. Configure config.yml
You can find sample config data in Resources/config/config-sample.yml
file
5. Update Database Schema
As all setup done, now you need to update your database schema. To do so,run the following command from your project directory
Core Concepts
Logger
Logger
is the core service which are responsible for persist the event info. You can define as many logger as you like.
EasyAudit Bundled with a logger service xiidea.easy_audit.logger.service
which is the default logger service. You can easily
disable the service by setting default_logger: false
in configuration.
Resolver
Resolver
is like translator for an event. It used to translate an event to AuditLog entity. EasyAudit bundled with two(2)
resolver services xiidea.easy_audit.default_event_resolver
, xiidea.easy_audit.default_doctrine_event_resolver
. And a
custom EventResolver class UserEventResolver
to illustrate how the transformation works. You can define as many resolver
service as you want and use them to handle different event. Here is the place you can set the severity level for a event. Default
level is Psr\Log\LogLevel::INFO
. Custom severity levels are not available. EasyAudit supports the logging levels
described by PSR-3. These values are present for basic filtering purposes. You can
use this value as channel to register different logger to handle different event. If you add any other field to your
AuditLog object, this is the place to add those extra information (tags, metadata, etc..)
Channel
It is now possible to register logger for specific channel. channel is refers to log level. you can configure EasyAudit logger services to handle only specific level of event.
Warning - BC Breaking Changes
-
Since v1.2.2
pre_persist_listener
option has been removed. You can use this cookbook to achieve the same functionality -
Since v1.2.2
EventResolverInterface
been split intoEmbeddedEventResolverInterface
andEventResolverInterface
-
Since v1.3.x The new Event object has been adapted. And the signature of
EmbeddedEventResolverInterface
andEventResolverInterface
also changed. Now it expects extra $eventName parameter - Since v1.4.7
EntityEventResolver
been refactored to a simplified version, if your code directly depends on older version of the implementation you are advised to copy the content of old implementation from here - Since v2.0 The FosUserBundle Events are removed from
UserEventResolver
and Event class usingSymfony\Contracts\*
namespace - Since v3.0 As
Symfony\Component\Security\Core\Event\AuthenticationEvent
not exists anymore,security.authentication.failure
resolver also removed.Cookbook
Look the cookbook for another interesting things.
All versions of easy-audit with dependencies
psr/log Version ^1|^2|^3
symfony/framework-bundle Version >=6.0 <7.0.0
symfony/security-bundle Version >=6.0 <7.0.0