Download the PHP package elgentos/masquerade without Composer
On this page you can find all versions of the php package elgentos/masquerade. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download elgentos/masquerade
More information about elgentos/masquerade
Files in elgentos/masquerade
Package masquerade
Short Description Framework-agnostic database seeder with fake data
License MIT
Informations about the package masquerade
Masquerade
This project is ABANDONED. Thanks for your support!
This project has been abandoned. For a better, faster and more maintained alternative, see Smile's gdpr-dump. We have created our own repository for config files for popular Magento 2 extensions, see elgentos/gdpr-dump-magento-2-extensions.
Faker-driven, platform-agnostic, locale-compatible data faker tool
Point Masquerade to a database, give it a rule-set defined in YAML and Masquerade will anonymize the data for you automatically!
Out-of-the-box supported frameworks
- Magento 2
- Shopware 6
Customization
You can add your own configuration files in a directory named config
in the same directory as where you run masquerade. The configuration files will be merged with any already present configuration files for that platform, overriding any out-of-the-box values.
See the Magento 2 YAML files as examples for notation.
For example, to override the admin.yaml
for Magento 2, you place a file in config/magento2/admin.yaml
. For example, if you want to completely disable/skip a group, just add this content;
You can add your own config files for custom tables or tables from 3rd party vendors. Here are a few examples:
To generate such files, you can run the masquerade identify
command. This will look for columns that show a hint of personal identifiable data in the name, such as name
or address
. It will interactively ask you to add it to a config file for the chosen platform.
Partial anonymization
You can affect only certain records by including a 'where' clause - for example to avoid anonymising certain admin accounts, or to preserve data used in unit tests, like this:
Delete Data
You might want to fully or partially delete data - eg. if your developers don't need sales orders, or you want to keep the database size a lot smaller than the production database. Specify the 'delete' option.
When deleting some Magento data, eg. sales orders, add the command line option --with-integrity
which enforces foreign key checks, so for example sales_invoice records will be deleted automatically if their parent sales_order is deleted:
If you use 'delete' without a 'where', and without '--with-integrity', it will use 'truncate' to delete the entire table. It will not use truncate if --with-integrity is specified since that bypasses key checks.
Magento EAV Attributes
You can use the Magento2Eav table type to treat EAV attributes just like normal columns, eg.
Formatter Options
For formatters, you can use all default Faker formatters.
Custom Data Providers / Formatters
You can also create your own custom providers with formatters. They need to extend Faker\Provider\Base
and they need to live in either ~/.masquerade
or .masquerade
relative from where you run masquerade.
An example file .masquerade/Custom/WoopFormatter.php
;
And then use it in your YAML file. A provider needs to be set on the column name level, not on the formatter level.
Custom Table Type Providers
Some systems have linked tables containing related data - eg. Magento's EAV system, Drupal's entity fields and Wordpress's post metadata tables. You can provide custom table types. In order to do it you need to implement 2 interfaces:
Elgentos\Masquerade\DataProcessorFactory
is to instantiate your custom processor. It receives table service factory, output object and whole array of yaml configuration specified for your table.-
Elgentos\Masquerade\DataProcessor
is to process various operations required by run command like:truncate
should truncate table in provided table via configurationdelete
should delete table in provided table via configurationupdateTable
should update table with values provided by generator based on columns definitions in the configuration. SeeElgentos\Masquerade\DataProcessor\RegularTableProcessor::updateTable
for a reference.
First you need to start with a factory that will instantiate an actual processor
An example file .masquerade/Custom/WoopTableFactory.php
;
An example file .masquerade/Custom/WoopTable.php
;
And then use it in your YAML file. A processor factory needs to be set on the table level, and can be a simple class name, or a set of options which are available to your class.
Installation
Download the phar file:
Usage
You can also set these variables in a config.yaml
file in the same location as where you run masquerade from, for example:
Running it nightly
Check out the wiki on how to run Masquerade nightly in CI/CD;
Building from source
To build the phar from source you can use the build.sh
script. Note that it depends on Box which is included in this repository.
Debian Packaging
To build a deb for this project run:
To generate a new debian/changelog
for a new release:
Credits
All versions of masquerade with dependencies
doctrine/dbal Version ~3.2
elgentos/parser Version ~3.0
illuminate/database Version ^8.75
symfony/console Version ^5.4
symfony/yaml Version ^5.4
fakerphp/faker Version ^1.17
webmozart/assert Version ^1.11