An open API service indexing awesome lists of open source software.

https://github.com/matiux/broadway-sensitive-serializer

Broadway serializer implementation with data sensitization support
https://github.com/matiux/broadway-sensitive-serializer

broadway cqrs cqrs-es gdpr php sensitive

Last synced: 6 months ago
JSON representation

Broadway serializer implementation with data sensitization support

Awesome Lists containing this project

README

          

Sensitization support for [broadway/broadway](https://github.com/broadway/broadway)
===

![check dependencies](https://github.com/matiux/broadway-sensitive-serializer/actions/workflows/check-dependencies.yml/badge.svg)
![test](https://github.com/matiux/broadway-sensitive-serializer/actions/workflows/tests.yml/badge.svg)
[![codecov](https://codecov.io/gh/matiux/broadway-sensitive-serializer/branch/master/graph/badge.svg)](https://codecov.io/gh/matiux/broadway-sensitive-serializer)
[![type coverage](https://shepherd.dev/github/matiux/broadway-sensitive-serializer/coverage.svg)](https://shepherd.dev/github/matiux/broadway-sensitive-serializer)
[![psalm level](https://shepherd.dev/github/matiux/broadway-sensitive-serializer/level.svg)](https://shepherd.dev/github/matiux/broadway-sensitive-serializer)
![security analysis status](https://github.com/matiux/broadway-sensitive-serializer/actions/workflows/security-analysis.yml/badge.svg)
![coding standards status](https://github.com/matiux/broadway-sensitive-serializer/actions/workflows/coding-standards.yml/badge.svg)
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/matiux/broadway-sensitive-serializer?color=blue)
![Read the Docs (version)](https://img.shields.io/readthedocs/broadway-sensitive-serializer/latest)

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

Normal Broadway event payload
```json
{
"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
```json
{
"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](https://github.com/matiux/broadway-sensitive-serializer-bundle)

Read the [doc](https://broadway-sensitive-serializer.readthedocs.io/en/latest/) for more information.

## Install
```shell
composer require matiux/broadway-sensitive-serializer
```
## Setup for development

```shell
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](https://github.com/nektos/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](./makefile)

Some uses:
```shell
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](./makefile) for all the options.

### Install dependencies to run test or execute examples
```shell
make build-php ARG="--no-cache"
make upd
make composer ARG="install"
```

### Run test
```shell
make build-php ARG="--no-cache"
make upd
make phpunit
```

## Example code
Read the [examples section](https://broadway-sensitive-serializer.readthedocs.io/en/latest/examples.html)