Skip to content
guvra edited this page Jun 6, 2024 · 9 revisions

GdprDump is a tool written in PHP that can be used to create anonymized database dumps.

Prerequisites

PHP

GdprDump Version PHP Requirement Maintained?
4.x (latest) >= 8.1 Yes
3.x >= 7.4 No
2.x >= 7.3 No
1.x >= 7.0 No

MySQL

This tool is compatible with MySQL databases. It was tested with the following databases:

  • MySQL
  • MariaDB
  • Percona

Installation

Phar File (recommended)

A phar file is available for downloading in the releases section. This is the recommended way to install this application.

To fetch the latest version:

wget https://github.com/Smile-SA/gdpr-dump/releases/latest/download/gdpr-dump.phar
chmod +x gdpr-dump.phar
./gdpr-dump.phar --version

With Composer

It can be installed with the following command:

composer create-project --no-dev --prefer-dist smile/gdpr-dump

How To Use

Configuration File

To use GdprDump, you must first create a configuration file (yaml format).

Example of a basic configuration file:

---
database:
    host: '%env(DB_HOST)%'
    user: '%env(DB_USER)%'
    password: '%env(DB_PASSWORD)%'
    name: '%env(DB_NAME)%'

tables:
    # Anonymize a table named "users"
    users:
        converters:
            username:
                converter: 'randomizeText'
                unique: true
            password:
                converter: 'randomizeText'

You can find an advanced example here (dumps a Magento database).

Dump Creation

The following command generates a database dump:

./gdpr-dump.phar config.yaml > dump.sql

Arguments:

Options:

  • -v: displays a progress bar to stderr

By default, the dump is sent to the standard output of the terminal (same behavior as mysqldump). This behavior can be changed in the configuration file, as documented here.

Clone this wiki locally