Skip to content

DbToolsBundle

Back up, restore and anonymize databases


OriginalAnonymized

Anonymize from a simple YAML configuration

Map each column of each table you want to anonymize with a specific anonymizer.

yaml
account:
  fisrt_name: firstname
  last_name: lastname
  email_address:
    anonymizer: email
    options: {domain: 'db-tools-bundle.org'}
  hashed_password: password

Learn more about anonymization

Enjoy full integration with Symfony & Laravel

DbToolsBundle provides a bundle for Symfony and an experimental package for Laravel. These integrations include autoconfiguration of database connection.

Learn more about Symfony integrationLearn more about Laravel integration

php
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MakinaCorpus\DbToolsBundle\Attribute\Anonymize; 

#[ORM\Entity()]
#[ORM\Table(name: 'customer')]
class Customer
{
    #[ORM\Column(length: 255)]
    #[Anonymize(type: 'firstname')] 
    private ?string $firstName = null;

    #[ORM\Column(length: 255)]
    #[Anonymize(type: 'lastname')] 
    private ?string $lastName = null;

    #[ORM\Column(length: 255)] 
    #[Anonymize(type: 'email')]
    private ?string $emailAddress = null;

    #[ORM\Column(length: 255)]
    #[Anonymize(type: 'password')] 
    private ?string $hashedPassword = null;
}
php
<?php
// config/db-tools.php

declare(strict_types=1);

return [
  // ...
  'anonymization' => [
    'first_name' => [
      'anonymizer' => 'firstname'
    ]
    'last_name' => [
      'anonymizer' => 'lastname'
    ]
    'email_address' => [
      'anonymizer' => 'email'
    ]
    'hashed_password' => [
      'anonymizer' => 'password'
    ]
  ],
];
yaml
services:
  postgres:
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_DB: db
      POSTGRES_USER: db
    ports:
      - 5439:5432
    networks:
      - site

  dbtools: 
    image: makinacorpus/dbtoolsbundle:stable
    networks: 
      - site
    volumes: 
      - ./db_tools.config.yaml:/var/www/db_tools.config.yaml

networks:
  site:

Set up an anonymization workflow on your CI/CD

Our Docker image unlocks the DbToolsBundle features for every DevOps teams. Simply add our image to your docker-compose.yaml!

Learn more about Docker image

developed by

Released under the MIT License.