PHPackages                             elgentos/masquerade - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. elgentos/masquerade

Abandoned → [smile/gdpr-dump](/?search=smile%2Fgdpr-dump)ArchivedLibrary[Database &amp; ORM](/categories/database)

elgentos/masquerade
===================

Framework-agnostic database seeder with fake data

1.2.2(3y ago)2388.2k40[14 issues](https://github.com/elgentos/masquerade/issues)[2 PRs](https://github.com/elgentos/masquerade/pulls)MITPHPPHP ^7.4|^8

Since Jul 10Pushed 2y ago6 watchersCompare

[ Source](https://github.com/elgentos/masquerade)[ Packagist](https://packagist.org/packages/elgentos/masquerade)[ RSS](/packages/elgentos-masquerade/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (35)Used By (0)

 [![Masquerade logo](https://raw.githubusercontent.com/elgentos/masquerade/master/art/logo.png)](https://raw.githubusercontent.com/elgentos/masquerade/master/art/logo.png)

Masquerade
==========

[](#masquerade)

This project is ABANDONED. Thanks for your support!
---------------------------------------------------

[](#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](https://github.com/smile-SA/gdpr-dump/). We have created our own repository for config files for popular Magento 2 extensions, see [elgentos/gdpr-dump-magento-2-extensions](https://github.com/elgentos/gdpr-dump-magento-2-extensions/).

Faker-driven, platform-agnostic, locale-compatible data faker tool
------------------------------------------------------------------

[](#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!

[![](https://user-images.githubusercontent.com/431360/42574650-30e8d186-851f-11e8-9693-c23b426c43f2.png)](https://user-images.githubusercontent.com/431360/42574650-30e8d186-851f-11e8-9693-c23b426c43f2.png)

### Out-of-the-box supported frameworks

[](#out-of-the-box-supported-frameworks)

- Magento 2
- Shopware 6

### Customization

[](#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](https://github.com/elgentos/masquerade/tree/master/src/config/magento2) 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;

```
admin:

```

You can add your own config files for custom tables or tables from 3rd party vendors. Here are a few examples:

- [Magento 2 Aheadworks YAML file](https://github.com/elgentos/masquerade/wiki/%5BMagento-2%5D-Aheadworks-YAML-file)
- [Magento 2 Amasty YAML file](https://github.com/elgentos/masquerade/wiki/%5BMagento-2%5D-Amasty-YAML-file)
- [Shopware 6 Frosh YAML file](https://github.com/elgentos/masquerade/wiki/%5BShopware-6%5D-Frosh-YAML-file)

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

[](#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:

```
customers:
  customer_entity:
    provider: # this sets options specific to the type of table
      where: "`email` not like '%@mycompany.com'" # leave mycompany.com emails alone
```

### Delete Data

[](#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:

```
orders:
  sales_order:
    provider:
      delete: true
      where: "customer_id != 3" # delete all except customer 3's orders because we use that for testing
    # no need to specify columns if you're using 'delete'
```

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

[](#magento-eav-attributes)

You can use the Magento2Eav table type to treat EAV attributes just like normal columns, eg.

```
products:
  catalog_product_entity: # specify the base table of the entity
    eav: true
    provider:
      where: "sku != 'TESTPRODUCT'" # you can still use 'where' and 'delete'
    columns:
      my_custom_attribute:
        formatter: sentence
      my_other_attribute:
        formatter: email

  catalog_category_entity:
    eav: true
    columns:
      description: # refer to EAV attributes like normal columns
        formatter: paragraph
```

### Formatter Options

[](#formatter-options)

For formatters, you can use all default [Faker formatters](https://github.com/fzaninotto/Faker#formatters).

#### Custom Data Providers / 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`;

```
