Download the PHP package eaudeweb/gdpr-dump without Composer
On this page you can find all versions of the php package eaudeweb/gdpr-dump. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eaudeweb/gdpr-dump
More information about eaudeweb/gdpr-dump
Files in eaudeweb/gdpr-dump
Package gdpr-dump
Short Description A drop-in replacement for mysqldump that optionally sanitizes DB fields for better GDPR conformity.
License GPL-2.0-or-later
Informations about the package gdpr-dump
GDPR Dump
A drop-in replacement for mysqldump that optionally sanitizes DB fields for better GDPR conformity.
It is based on the ifsnop/mysqldump-php library, and can in principle dump any database that PDO supports.
How to use
There are presently two ways of manipulating data, the first is by manipulating the actual SQL queries that are run on the server (given by the gdpr-expressions path), and the second is by replacing column output before the dump is generated (given by the gdpr-replacements option).
The fields to obfuscate are passed via a --gdpr-expressions
parameter.
Note that we use uid
expression to satisfy unique keys.
The same without obfuscation:
Using gdpr-replacements
This uses Faker for most of the column sanitization.
Presently, the tool searches for the "gdpr-replacements" option, either passed as a command line argument, or as part of a MySql options file.
The "gdpr-replacements" option expects a JSON string with the following format
Where formatterType is one of the following
- name - generates a name
- phoneNumber - generates a phone number
- username - generates a random user name
- password - generates a random password
- email - generates a random email address
- date - generates a date
- longText - generates a sentence
- number - generates a number
- randomText - generates a sentence
- text - generates a paragraph
- uri - generates a URI
- clear - generates an empty string
This will replace the given column's value with Faker output.
You can also save replacements mapping to JSON file and use it with --gdpr-replacements-file
option.
Use with drush
As this mimicks mysqldump, it can be use with drush, backup_migrate and any tool that uses mysqldump. Drush example:
MySqlOptions file
You are able to have your gdpr-expressions/replacement options set in a mysql options file file.
It is to appear under the [mysqldump]
section.
So, for example, you might have /etc/my.cnf
with the following content
Status and further development
Currently this is a proof of concept to spark a community process.
Especially the --gdpr-expressions
option is neither handy to write for humans, nor does it scale well.
Here we might need better options.
Contributors notes
- Note that the project follows PSR-2 for formatting.
All versions of gdpr-dump with dependencies
eaudeweb/mysqldump-php Version ^2.8
cweagans/composer-patches Version ^1.6
bomoko/mysql-cnf-parser Version ^0.0.2
fakerphp/faker Version ^1.20
symfony/event-dispatcher Version ~3.4|~4.0|~5.0|~6.0