{"id":14983723,"url":"https://github.com/xiidea/easyauditbundle","last_synced_at":"2025-04-06T01:10:04.140Z","repository":{"id":11867502,"uuid":"14427334","full_name":"xiidea/EasyAuditBundle","owner":"xiidea","description":"A Symfony Bundle To Log Selective Events","archived":false,"fork":false,"pushed_at":"2023-11-04T16:45:53.000Z","size":412,"stargazers_count":88,"open_issues_count":10,"forks_count":21,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-04-24T19:23:51.927Z","etag":null,"topics":["audit-log","audit-log-entity","audit-trail","php","psr-3","symfony","symfony-bundle","symfony3","symfony4","symfony5","symfony6"],"latest_commit_sha":null,"homepage":"http://xiidea.github.io/EasyAuditBundle/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiidea.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-11-15T15:10:43.000Z","updated_at":"2024-06-19T00:22:01.101Z","dependencies_parsed_at":"2023-01-14T12:14:17.999Z","dependency_job_id":"18e44e05-9b0c-4bd9-b832-41d66ec35788","html_url":"https://github.com/xiidea/EasyAuditBundle","commit_stats":{"total_commits":250,"total_committers":11,"mean_commits":"22.727272727272727","dds":0.07199999999999995,"last_synced_commit":"4862e1739c8b017355bdbffc825475313f8fa810"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiidea%2FEasyAuditBundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiidea%2FEasyAuditBundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiidea%2FEasyAuditBundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiidea%2FEasyAuditBundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiidea","download_url":"https://codeload.github.com/xiidea/EasyAuditBundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247419861,"owners_count":20936012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit-log","audit-log-entity","audit-trail","php","psr-3","symfony","symfony-bundle","symfony3","symfony4","symfony5","symfony6"],"created_at":"2024-09-24T14:07:49.902Z","updated_at":"2025-04-06T01:10:04.111Z","avatar_url":"https://github.com/xiidea.png","language":"PHP","readme":"# Easy Audit\n\n[![Build Status](https://travis-ci.org/xiidea/EasyAuditBundle.svg?branch=master)](https://travis-ci.org/xiidea/EasyAuditBundle)\n[![Coverage Status](https://coveralls.io/repos/xiidea/EasyAuditBundle/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/xiidea/EasyAuditBundle?branch=master)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/xiidea/EasyAuditBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/xiidea/EasyAuditBundle/?branch=master)\n[![Latest Stable Version](https://poser.pugx.org/xiidea/easy-audit/v/stable.png)](https://packagist.org/packages/xiidea/easy-audit)\n[![Latest Unstable Version](http://poser.pugx.org/xiidea/easy-audit/v/unstable)](https://packagist.org/packages/xiidea/easy-audit)\n[![Total Downloads](https://poser.pugx.org/xiidea/easy-audit/downloads.png)](https://packagist.org/packages/xiidea/easy-audit)\n[![License](http://poser.pugx.org/xiidea/easy-audit/license)](https://packagist.org/packages/xiidea/easy-audit)\n\nA Symfony Bundle To Log Selective Events. It is easy to configure and easy to customize for your need.\n\n### Versions\n\n| Symfony |    PHP    |                        EasyAuditBundle                        |       Support       |\n|:-------:|:---------:|:-------------------------------------------------------------:|:-------------------:|\n|   6.x   |  \u003e=8.0.2  |                             3.x.x                             | New Features / Bugs |\n|   5.x   |  \u003e=7.2.5  | [2.x.x](https://github.com/xiidea/EasyAuditBundle/tree/2.0.x) |        Bugs         |\n| 2.7-4.4 | ^5.6,^7.0 | [1.4.x](https://github.com/xiidea/EasyAuditBundle/tree/1.4.x) |          -          |\n|  \u003c=2.8  | ^5.4-7.3  | [1.3.x](https://github.com/xiidea/EasyAuditBundle/tree/1.3.x) |          -          |\n|  \u003c=2.4  |   ^5.4    | [1.2.x](https://github.com/xiidea/EasyAuditBundle/tree/1.2.x) |          -          |\n\n\n## Install\n\n1.  Add EasyAuditBundle in your composer.json\n2.  Enable the Bundle\n3.  Create audit_log entity class\n4.  Configure config.yml\n5.  Update Database Schema\n\n### 1. Add EasyAuditBundle in your composer.json\n\nAdd EasyAuditBundle in your composer.json:\n\n```json\n{\n    \"require\": {\n        \"xiidea/easy-audit\": \"^3.0\"\n    }\n}\n```\n\nNow tell composer to download the bundle by running the command:\n\n```bash\n$ php composer.phar update xiidea/easy-audit\n```\n\nComposer will install the bundle to your project's `vendor/xiidea` directory.\n\n### 2. Enable the Bundle\n\n```php\n\u003c?php\n// app/AppKernel.php\n\npublic function registerBundles()\n{\n    $bundles = array(\n        // ...\n        new Xiidea\\EasyAuditBundle\\XiideaEasyAuditBundle(),\n    );\n}\n```\n\n### 3. Create audit_log entity class\n\nThe XiideaEasyAuditBundle supports Doctrine ORM/MongoDB by default. However, you must provide a concrete AuditLog class. Follow the [instructions](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/audit-log-entity-orm.md) to set up the class:\n\n### 4. Configure config.yml\n\nYou can find sample config data in `Resources/config/config-sample.yml` file\n\n```yaml\n# app/config/config.yml\nxiidea_easy_audit:\n    #resolver: xiidea.easy_audit.default_event_resolver                           #Optional\n    #audit_log_class : MyProject\\Bundle\\MyBundle\\Entity\\AuditLog                  #Required\n    #doctrine_event_resolver : xiidea.easy_audit.default_doctrine_event_resolver  #Optional\n    #default_logger : true                                                        #Optional\n    \n    #user property to use as actor of an event\n    #valid value will be any valid property of your user class\n    user_property : ~ # or username                            #Optional\n\n    #List of doctrine entity:event you wish to track or set to false to disable logs for doctrine events\n    # valid events are = [created, updated, deleted]\n    #doctrine_objects :                                              #Optional\n    #     MyProject\\Bundle\\MyBundle\\Entity\\MyEntity : [created, updated, deleted]\n    #     MyProject\\Bundle\\MyBundle\\Entity\\MyEntity2 : []\n\n    #List all events you want to track  (Optional from v1.2.1 you can now use subscriber to define it)\n    events :                                                   #Optional\n        - security.interactive_login\n\n    #List all custom resolver for event\n    #custom_resolvers :\n    #       security.interactive_login : user.event_resolver\n\n    #logger_channel:\n    #    xiidea.easy_audit.logger.service: [\"info\", \"debug\"]\n    #    file.logger: [\"!info\", \"!debug\"]\n\n    #Custom Event Resolver Service\nservices:\n    #user.event_resolver:\n    #     class: Xiidea\\EasyAuditBundle\\Resolver\\UserEventResolver\n    #     calls:\n    #        - [ setContainer,[ @service_container ] ]\n```\n\n### 5. Update Database Schema\n\nAs all setup done, now you need to update your database schema. To do so,run the following command from your project directory\n\n```bash\n$ php app/console doctrine:schema:update --force\n```\n\n## Core Concepts\n\n### Logger\n\n`Logger` is the core service which are responsible for persist the event info. You can define as many logger as you like.\nEasyAudit Bundled with a logger service `xiidea.easy_audit.logger.service` which is the default logger service. You can easily\ndisable the service by setting `default_logger: false` in configuration.\n\n### Resolver\n\n`Resolver` is like translator for an event. It used to translate an event to AuditLog entity. EasyAudit bundled with two(2)\nresolver services `xiidea.easy_audit.default_event_resolver`, `xiidea.easy_audit.default_doctrine_event_resolver`. And a\ncustom EventResolver class `UserEventResolver` to illustrate how the transformation works. You can define as many resolver\nservice as you want and use them to handle different event. Here is the place you can set the severity level for a event. Default\nlevel is `Psr\\Log\\LogLevel::INFO`. Custom severity levels are not available. EasyAudit supports the logging levels\ndescribed by [PSR-3](http://www.php-fig.org/psr/psr-3). These values are present for basic filtering purposes. You can\nuse this value as channel to register different logger to handle different event. If you add any other field to your\nAuditLog object, this is the place to add those extra information (tags, metadata, etc..)\n\n### Channel\n\nIt is now possible to register logger for specific channel. channel is refers to log level. you can configure EasyAudit logger\nservices to handle only specific level of event.\n\n## Warning - BC Breaking Changes\n\n-   Since v1.2.2 `pre_persist_listener` option has been removed. You can use \n[this cookbook](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/pre-persist-listener.md) \nto achieve the same functionality\n\n-   Since v1.2.2 `EventResolverInterface` been split into `EmbeddedEventResolverInterface` and `EventResolverInterface`\n\n-   Since v1.3.x The new Event object has been adapted. And the signature of `EmbeddedEventResolverInterface` and \n    `EventResolverInterface` also changed. Now it expects extra $eventName parameter\n         \n-   Since v1.4.7 `EntityEventResolver` been refactored to a simplified version, if your code directly depends on older version of the implementation\n    you are advised to copy the content of old implementation from [here](https://github.com/xiidea/EasyAuditBundle/blob/1.4.6/Resolver/EntityEventResolver.php)\n-   Since v2.0 The FosUserBundle Events are removed from `UserEventResolver` and Event class using `Symfony\\Contracts\\*` namespace\n-   Since v3.0 As `Symfony\\Component\\Security\\Core\\Event\\AuthenticationEvent` not exists anymore, `security.authentication.failure` resolver also removed.\n## Cookbook\n\nLook the cookbook for another interesting things.\n\n-   [Embed Resolver with event](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/embed-resolver.md)\n-   [Define events with subscriber](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/subscriber.md)\n-   [Override Resolver](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/override-resolver.md)\n-   [Custom Logger](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/custom-logger.md)\n-   [Custom Resolver](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/custom-resolver.md)\n-   [Doctrine Object Event](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/doctrine-entity-events.md)\n-   [Pre-Persist Listener](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/pre-persist-listener.md)\n-   [Logger Channel](https://github.com/xiidea/EasyAuditBundle/blob/master/Resources/doc/logger-channel.md)   \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiidea%2Feasyauditbundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiidea%2Feasyauditbundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiidea%2Feasyauditbundle/lists"}