richardhj/privacy-dump

A utility to create anonymized database dumps

dev-main 2020-07-07 15:39 UTC

This package is auto-updated.

Last update: 2024-04-15 20:05:27 UTC


README

Create purged and anonymized MySQL database dumps

About

This package provides a framework-agnostic database backup manager for creating anonymized database dumps.

It is the equivalent of mysqldump, with additional features, at the cost of performance (PHP implementation). The main purpose of this tool is to create anonymized dumps, in order to comply with GDPR regulations.

Features:

  • Data converters (transform the data before it is dumped to the file)
  • Table filtering
  • Tables include list (only these tables will be included in the dump)
  • Tables exclude list (not included in the dump)

Installation

composer require richardhj/privacy-dump

Other integrations

To use in a Symfony project, use richardhj/privacy-dump-bundle.

Usage

// 1. Define configuration

$options = [
    'database' => [],
    'dump' => [],
    'tables_include' => [],
    'tables_exclude' => [],
    'tables' => [],
];

// 2. Create configuration instance

$config = new \Richardhj\PrivacyDump\Config\Config($options);

// 3. Dump

$dumper = new SqlDumper();
$dumper->dump($config, 'file.sql');

For the full options, please relate to https://github.com/Smile-SA/gdpr-dump/blob/master/docs/01-configuration.md#dump-settings.

Credits and License

This project is a modification of Smile-SA/gdpr-dump and thus licensed under the same GPLv3 License.

Changes made on the original package:

  • Refactoring from standalone application to installable package
  • Changes in configuration