Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (118) | Download .zip | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 104 | All time: 9,344 This week: 270 |
Version | License | PHP version | Categories | |||
easyauditbundle 1.4 | Custom (specified... | 5.6 | PHP 5, Libraries, Logging |
A Symfony2 Bundle To Log Selective Events. It is easy to configure and easy to customize for your need.
Note: If you are using Symfony version older then 2.4 you need to use EasyAuditBundle 1.2.x Note: If you are using Symfony version older then 2.6 you need to use EasyAuditBundle 1.3.x
Add EasyAuditBundle in your composer.json:
{
"require": {
"xiidea/easy-audit": "^1.4"
}
}
Now tell composer to download the bundle by running the command:
$ php composer.phar update xiidea/easy-audit
Composer will install the bundle to your project's vendor/xiidea
directory.
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Xiidea\EasyAuditBundle\XiideaEasyAuditBundle(),
);
}
The XiideaEasyAuditBundle supports Doctrine ORM by default. However, you must provide a concrete AuditLog class. Follow the instructions to set up the class:
You can find sample config data in Resources/config/config-sample.yml
file
# app/config/config.yml
xiidea_easy_audit:
#resolver: xiidea.easy_audit.default_event_resolver #Optional
#entity_class : MyProject\Bundle\MyBundle\Entity\AuditLog #Required
#entity_event_resolver : xiidea.easy_audit.default_entity_event_resolver #Optional
#default_logger : true #Optional
#user property to use as actor of an event
#valid value will be any valid property of your user class
user_property : ~ # or username #Optional
#List of doctrine entity:event you wish to track or set to false to disable logs for doctrine events
# valid events are = [created, updated, deleted]
#doctrine_entities : #Optional
# MyProject\Bundle\MyBundle\Entity\MyEntity : [created, updated, deleted]
# MyProject\Bundle\MyBundle\Entity\MyEntity2 : []
#List all events you want to track (Optional from v1.2.1 you can now use subscriber to define it)
events : #Optional
- security.interactive_login
#List all custom resolver for event
#custom_resolvers :
# security.interactive_login : user.event_resolver
# security.authentication.failure : user.event_resolver
#logger_channel:
# xiidea.easy_audit.logger.service: ["info", "debug"]
# file.logger: ["!info", "!debug"]
#Custom Event Resolver Service
services:
#user.event_resolver:
# class: Xiidea\EasyAuditBundle\Resolver\UserEventResolver
# calls:
# - [ setContainer,[ @service_container ] ]
As all setup done, now you need to update your database schema. To do so,run the following command from your project directory
$ php app/console doctrine:schema:update --force
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
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_entity_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..)
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.
Look the cookbook for another interesting things.
Files |
File | Role | Description | ||
---|---|---|---|---|
Annotation (1 file) | ||||
Common (1 file) | ||||
Controller (1 file) | ||||
DependencyInjection (2 files, 1 directory) | ||||
Entity (1 file) | ||||
Events (2 files) | ||||
Exception (3 files) | ||||
Listener (1 file) | ||||
Logger (4 files) | ||||
Resolver (6 files, 1 directory) | ||||
Resources (3 directories) | ||||
Subscriber (3 files) | ||||
Tests (3 files, 10 directories) | ||||
Traits (2 files) | ||||
.coveralls.yml | Data | Auxiliary data | ||
.scrutinizer.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
XiideaEasyAuditBundle.php | Class | Class source |
Files | / | DependencyInjection |
File | Role | Description | ||
---|---|---|---|---|
Compiler (3 files) | ||||
Configuration.php | Class | Class source | ||
XiideaEasyAuditExtension.php | Class | Class source |
Files | / | DependencyInjection | / | Compiler |
File | Role | Description |
---|---|---|
LoggerFactoryPass.php | Class | Class source |
MonologLoggerPass.php | Class | Class source |
SubscriberPass.php | Class | Class source |
Files | / | Events |
File | Role | Description |
---|---|---|
DoctrineEntityEvent.php | Class | Class source |
DoctrineEvents.php | Class | Class source |
Files | / | Exception |
File | Role | Description |
---|---|---|
InvalidServiceException.php | Class | Class source |
UnrecognizedEntityException.php | Class | Class source |
UnrecognizedEventInfoException.php | Class | Class source |
Files | / | Logger |
File | Role | Description |
---|---|---|
Logger.php | Class | Class source |
LoggerFactory.php | Class | Class source |
LoggerInterface.php | Class | Class source |
MonologLogger.php | Class | Class source |
Files | / | Resolver |
File | Role | Description | ||
---|---|---|---|---|
UserEventCommand (6 files) | ||||
DefaultEventResolver.php | Class | Class source | ||
EmbeddedEventResolverInterface.php | Class | Class source | ||
EntityEventResolver.php | Class | Class source | ||
EventResolverFactory.php | Class | Class source | ||
EventResolverInterface.php | Class | Class source | ||
UserEventResolver.php | Class | Class source |
Files | / | Resolver | / | UserEventCommand |
File | Role | Description |
---|---|---|
AuthenticationFailedCommand.php | Class | Class source |
ImplicitLoginCommand.php | Class | Class source |
InteractiveLoginCommand.php | Class | Class source |
PasswordChangedCommand.php | Class | Class source |
ResolverCommand.php | Class | Class source |
UserLoginCommand.php | Class | Class source |
Files | / | Resources |
Files | / | Resources | / | config |
File | Role | Description | ||
---|---|---|---|---|
default (3 files) | ||||
config-sample.yml | Data | Auxiliary data | ||
doctrine_services.yml | Data | Auxiliary data | ||
routing.yml | Data | Auxiliary data | ||
services.yml | Data | Auxiliary data |
Files | / | Resources | / | config | / | default |
File | Role | Description |
---|---|---|
entity-event-resolver.yml | Data | Auxiliary data |
event-resolver.yml | Data | Auxiliary data |
logger.yml | Data | Auxiliary data |
Files | / | Resources | / | doc |
File | Role | Description |
---|---|---|
audit-log-entity-orm.md | Class | Class source |
custom-logger.md | Class | Class source |
custom-resolver.md | Class | Class source |
doctrine-entity-events.md | Class | Class source |
embed-resolver.md | Class | Class source |
logger-channel.md | Data | Auxiliary data |
override-resolver.md | Data | Auxiliary data |
pre-persist-listener.md | Class | Class source |
subscriber.md | Class | Class source |
Files | / | Subscriber |
File | Role | Description |
---|---|---|
DoctrineDeleteEventLogger.php | Class | Class source |
DoctrineSubscriber.php | Class | Class source |
EasyAuditEventSubscriberInterface.php | Class | Class source |
Files | / | Tests |
File | Role | Description | ||
---|---|---|---|---|
Annotation (1 file) | ||||
Common (1 file) | ||||
DependencyInjection (1 file, 1 directory) | ||||
Entity (1 file) | ||||
Fixtures (3 directories) | ||||
Functional (5 files, 3 directories) | ||||
Listener (1 file) | ||||
Logger (3 files) | ||||
Resolver (3 files) | ||||
Subscriber (2 files) | ||||
bootstrap.php | Aux. | Auxiliary script | ||
XiideaEasyAuditBundleTest.php | Class | Class source | ||
XiideaTestListener.php | Class | Class source |
Files | / | Tests | / | DependencyInjection |
File | Role | Description | ||
---|---|---|---|---|
Compiler (3 files) | ||||
XiideaEasyAuditExtensionTest.php | Class | Class source |
Files | / | Tests | / | DependencyInjection | / | Compiler |
File | Role | Description |
---|---|---|
LoggerFactoryPassTest.php | Class | Class source |
MonologLoggerPassTest.php | Class | Class source |
SubscriberPassTest.php | Class | Class source |
Files | / | Tests | / | Fixtures | / | Common |
File | Role | Description |
---|---|---|
AuditObjectResolver.php | Class | Class source |
CustomEventResolver.php | Class | Class source |
DummyLifecycleEventArgs.php | Class | Class source |
DummyToken.php | Class | Class source |
DummyUserAwareComponent.php | Class | Class source |
EasySubscriberOne.php | Class | Class source |
EasySubscriberTwo.php | Class | Class source |
InvalidEventInfoResolver.php | Class | Class source |
InvalidEventResolver.php | Class | Class source |
InvalidLogger.php | Class | Class source |
NullResolver.php | Class | Class source |
Files | / | Tests | / | Fixtures | / | Event |
File | Role | Description |
---|---|---|
Basic.php | Class | Class source |
DummyAuthenticationFailureEvent.php | Class | Class source |
DummyFilterUserResponseEvent.php | Class | Class source |
DummyUserEvent.php | Class | Class source |
EntityEvent.php | Class | Class source |
WithEmbeddedResolver.php | Class | Class source |
Files | / | Tests | / | Fixtures | / | ORM |
File | Role | Description |
---|---|---|
AuditLog.php | Class | Class source |
DummyEntity.php | Class | Class source |
EntityWithoutGetMethod.php | Class | Class source |
Movie.php | Class | Class source |
UserEntity.php | Class | Class source |
Files | / | Tests | / | Functional |
File | Role | Description | ||
---|---|---|---|---|
Bundle (1 directory) | ||||
config (2 files, 1 directory) | ||||
Resources (1 directory) | ||||
BaseTestCase.php | Class | Class source | ||
CommonTest.php | Class | Class source | ||
ImpersonatingUserTest.php | Class | Class source | ||
ImpersonatingUserTestKernel.php | Class | Class source | ||
TestKernel.php | Class | Class source |
Files | / | Tests | / | Functional | / | Bundle | / | TestBundle |
File | Role | Description | ||
---|---|---|---|---|
Controller (1 file) | ||||
Entity (1 file) | ||||
Logger (1 file) | ||||
XiideaTestBundle.php | Class | Class source |
Files | / | Tests | / | Functional | / | Bundle | / | TestBundle | / | Controller |
File | Role | Description |
---|---|---|
DefaultController.php | Class | Class source |
Files | / | Tests | / | Functional | / | Bundle | / | TestBundle | / | Entity |
File | Role | Description |
---|---|---|
AuditLog.php | Class | Class source |
Files | / | Tests | / | Functional | / | Bundle | / | TestBundle | / | Logger |
File | Role | Description |
---|---|---|
FileLogger.php | Class | Class source |
Files | / | Tests | / | Functional | / | config |
File | Role | Description | ||
---|---|---|---|---|
common (4 files) | ||||
config.yml | Data | Auxiliary data | ||
switchuser.yml | Data | Auxiliary data |
Files | / | Tests | / | Functional | / | config | / | common |
File | Role | Description |
---|---|---|
framework.yml | Data | Auxiliary data |
logiin_routing.yml | Data | Auxiliary data |
routing.yml | Data | Auxiliary data |
security.yml | Data | Auxiliary data |
Files | / | Tests | / | Functional | / | Resources | / | views |
File | Role | Description |
---|---|---|
base.html.twig | Data | Auxiliary data |
Files | / | Tests | / | Logger |
File | Role | Description |
---|---|---|
LoggerFactoryTest.php | Class | Class source |
LoggerTest.php | Class | Class source |
MonologLoggerTest.php | Class | Class source |
Files | / | Tests | / | Resolver |
File | Role | Description |
---|---|---|
EntityEventResolverTest.php | Class | Class source |
EventResolverFactoryTest.php | Class | Class source |
UserEventResolverTest.php | Class | Class source |
Files | / | Tests | / | Subscriber |
File | Role | Description |
---|---|---|
DoctrineDeleteEventLoggerTest.php | Class | Class source |
DoctrineSubscriberTest.php | Class | Class source |
Files | / | Traits |
File | Role | Description |
---|---|---|
EntityHydrationMethod.php | Class | Class source |
ServiceContainerGetterMethods.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.