PHPackages                             igoooor/doctrine-log-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. igoooor/doctrine-log-bundle

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

igoooor/doctrine-log-bundle
===========================

Symfony bundle to enable auto logging doctrine entity changes.

02PHP

Since Mar 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/igoooor/doctrine-log-bundle)[ Packagist](https://packagist.org/packages/igoooor/doctrine-log-bundle)[ RSS](/packages/igoooor-doctrine-log-bundle/feed)WikiDiscussions main Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Fork from  while waiting for Symfony 5 compatiblity (see open issue)

DoctrineLogBundle
=================

[](#doctrinelogbundle)

Symfony bundle to enable auto logging data changes. Works with doctrine entities only. This bundle will save developer's ass to determine how data has been changed :)

Often projects need to log change to see the complete history of changes are made on an object. It's mainly for superadmin who needs to know these information. To control it from a central place and log automatically this bundle is developed. Using this bundle in your symfony project you can choose which entities you want to autolog. This bundle will automatically insert a record each time the data is changed. You can configure which property you want to track with 2 strategy.

This bundle is tested on symfony 4

Prerequisities
--------------

[](#prerequisities)

This bundle use `stof/doctrine-extensions-bundle` to use blameable and timestampable. Install the bundle first and configure to use blamable and timestampable. Read the installation guide here

Installation
============

[](#installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.

Applications that use Symfony Flex
----------------------------------

[](#applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
$ composer require manasbala/doctrine-log-bundle
```

Applications that don't use Symfony Flex
----------------------------------------

[](#applications-that-dont-use-symfony-flex)

### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
$ composer require manasbala/doctrine-log-bundle
```

### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Mb\DoctrineLogBundle\MbDoctrineLogBundle::class => ['all' => true],
];
```

### Step 3: Update database

[](#step-3-update-database)

It'll create the `mb_entity_log` table in your database

```
$ php bin/console doctrine:schema:update --force
```

### Step 4: Configure entities you need to log

[](#step-4-configure-entities-you-need-to-log)

Add `@Loggable` annotation in the entity you want to log changes. By default strategy will be `include_all`, all properties changes will be logged.

```
// src/Entity/User.php
