PHPackages                             tacticmedia/greenmask-bundle - 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. tacticmedia/greenmask-bundle

ActiveSymfony-bundle

tacticmedia/greenmask-bundle
============================

Symfony bundle that generates a greenmask anonymization configuration from transformer attributes on Doctrine entity properties.

00PHPCI failing

Since Aug 24Pushed todayCompare

[ Source](https://github.com/tacticmedia/greenmask-bundle)[ Packagist](https://packagist.org/packages/tacticmedia/greenmask-bundle)[ RSS](/packages/tacticmedia-greenmask-bundle/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Tactic Media Greenmask Bundle
=============================

[](#tactic-media-greenmask-bundle)

[![Packagist](https://camo.githubusercontent.com/de63ad7caeb0d64b8a5972779e3c468f0990256549b4d9b1991f9180559b9865/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7461637469636d656469612f677265656e6d61736b2d62756e646c65)](https://packagist.org/packages/tacticmedia/greenmask-bundle)[![PHP](https://camo.githubusercontent.com/5a5456c0917c223742e673f46c36ee8842b0db76ac58055d64a0cb18cc88866b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f7461637469636d656469612f677265656e6d61736b2d62756e646c652f706870)](https://packagist.org/packages/tacticmedia/greenmask-bundle)[![License](https://camo.githubusercontent.com/b0e3c00059b1b82bd9a1c0e5d1d38e72232ac4ff25e845f1d98f2064a3782067/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7461637469636d656469612f677265656e6d61736b2d62756e646c65)](LICENSE)

**TL;DR**: Declare anonymisation rules directly on your Doctrine entities, and let this bundle write the `dump.transformation` section of your [greenmask](https://greenmask.io) configuration for you. No more PII headaches. Turnkey dump and restore solution. Great for grabbing production data and restoring it in non-production environment where sensitive stuff does not belong.

---

Greenmask anonymises a PostgreSQL dump by applying a named transformer to each column you list in its configuration file. Maintaining that list by hand is the problem: it lives far away from the entities, it names raw tables and columns, and it goes stale the moment somebody adds a field.

This bundle moves the declaration to the property:

```
use Doctrine\ORM\Mapping as ORM;
use TacticMedia\GreenmaskBundle\Attribute\Transformer;
use TacticMedia\GreenmaskBundle\Attribute\Transformer\PartialEnum;

#[ORM\Entity]
#[ORM\Table(name: 'user', schema: 'core')]
class User
{
    #[ORM\Column(name: 'display_name')]
    #[Transformer\Masking(PartialEnum::NAME)]
    private string $displayName;

    #[ORM\Column]
    #[Transformer\RandomEmail(preserve: ['admin@example.com'], domains: ['disabled.localhost'])]
    private string $email;
}
```

One command turns the attributes into a greenmask configuration:

```
bin/console greenmask:generate-config config/greenmask.dist.yml config/greenmask.yml
```

```
dump:
  transformation:
    -
      schema: core
      name: user
      transformers:
        -
          name: Masking
          params:
            type: name
            column: display_name
        -
          name: RandomEmail
          when: 'record.email != "admin@example.com"'
          params:
            domains:
              - disabled.localhost
            column: email
```

The generator reads Doctrine metadata only, so it needs no database connection and runs inside a Docker image build.

All 51 greenmask transformers have an attribute, each covering the transformer's full parameter surface. Anything you leave alone is not written, so greenmask's own defaults keep applying.

Requirements
------------

[](#requirements)

- PHP 8.3 or newer
- Symfony 7.4 or 8.x
- Doctrine ORM 3.4 or newer

Installation
------------

[](#installation)

```
composer require tacticmedia/greenmask-bundle
```

See [Installation](docs/installation.md) for bundle registration.

Documentation
-------------

[](#documentation)

- [Installation](docs/installation.md) - requirements, Composer setup, bundle registration
- [Attributes](docs/attributes.md) - the index of all 51 transformer attributes, the arguments they share, and how to add your own
- [Generating the configuration](docs/generating-configuration.md) - the command, the template contract, running it in a Docker build
- [Backup and restore](docs/backup-and-restore.md) - creating an anonymised dump and restoring it
- [Demo](demo/README.md) - a runnable application: seed, generate, dump, restore, compare

Contributions
-------------

[](#contributions)

Non-LLM-slop contributions and issues are most definitely welcome.

License
-------

[](#license)

MIT. See [LICENSE](LICENSE).

One more thing
--------------

[](#one-more-thing)

This package is brought to you by [Tactic Media, a South Australian software development business](https://tacticmedia.com.au).

We love to help businesses become more efficient by automating tasks that shouldn't have been done by a human in the first place.

Head over to our website to check out what we do, and if you think we can help you give your employees more time to spend on something more creative, [let's talk](https://tacticmedia.com.au/contact.html)

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a32d26426a5a46eb135149043845f075a5c1ff65c9436217b2a54d8e50de4e04?d=identicon)[janklan](/maintainers/janklan)

---

Top Contributors

[![janklan](https://avatars.githubusercontent.com/u/5463371?v=4)](https://github.com/janklan "janklan (1 commits)")

---

Tags

anonymisationdoctrinegreenmaskpii-redactionsymfony

### Embed Badge

![Health badge](/badges/tacticmedia-greenmask-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tacticmedia-greenmask-bundle/health.svg)](https://phpackages.com/packages/tacticmedia-greenmask-bundle)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
