Skip to content

matiux/broadway-sensitive-serializer

Repository files navigation

Sensitization support for broadway/broadway

check dependencies test codecov type coverage psalm level security analysis status coding standards status Packagist PHP Version Support Read the Docs (version)

The idea behind this project is to make a CQRS+ES system compliant, specifically implemented through the Broadway library, with the General Data Protection Regulation (GDPR), in particular with the right to be forgotten.

Normal Broadway event payload

{
    "class": "SensitiveUser\\User\\Domain\\Event\\UserRegistered",
    "payload": {
        "id": "b0fce205-d816-46ac-886f-06de19236750",
        "name": "Matteo",
        "surname": "Galacci",
        "email": "m.galacci@gmail.com",
        "occurred_at": "2022-01-08T14:22:38.065+00:00"
    }
}

Example of a payload with the extension active

{
  "class": "SensitiveUser\\User\\Domain\\Event\\UserRegistered",
  "payload": {
    "id": "b0fce205-d816-46ac-886f-06de19236750",
    "name": "Matteo",
    "surname": "#-#2Iuofg4NKKPLAG2kdJrbmQ==:bxQo+zXfjUgrD0jHuht0mQ==",
    "email": "#-#OFLfN9XDKtWrmCmUb6mhY0Iz2V6wtam0pcqs6vDJFRU=:bxQo+zXfjUgrD0jHuht0mQ==",
    "occurred_at": "2022-01-08T14:22:38.065+00:00"
  }
}

The symfony bundle exists to simplify integration with the framework here

Read the doc for more information.

Install

composer require matiux/broadway-sensitive-serializer

Setup for development

git clone https://github.com/matiux/broadway-sensitive-serializer.git && cd broadway-sensitive-serializer
cp docker/docker-compose.override.dist.yml docker/docker-compose.override.yml
rm -rf .git/hooks && ln -s ../scripts/git-hooks .git/hooks

This repository uses GitHub actions to perform some checks. If you want to test the actions locally you can use act. For example if you want to check the action for static analysis

act -P ubuntu-latest=shivammathur/node:latest --job static-analysis

Interact with the PHP container

You can interact with the PHP container through the makefile

Some uses:

make upd
make enter
make phpunit
make psalm
make coding-standard-fix-staged
make build-php ARG="--no-cache"
make build-docs

Check out here for all the options.

Install dependencies to run test or execute examples

make build-php ARG="--no-cache"
make upd
make composer ARG="install"

Run test

make build-php ARG="--no-cache"
make upd
make phpunit

Example code

Read the examples section