mediamonks/doctrine-extensions

Doctrine2 behavioral extensions which allows to transform (encrypt, decrypt, hash) your data automatically

2.0.0 2021-04-12 07:05 UTC

This package is auto-updated.

Last update: 2021-11-27 09:40:32 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads Latest Stable Version Latest Unstable Version SensioLabs Insight License

MediaMonks Doctrine2 behavioral extensions

These extensions add more functionality to Doctrine2.

Breaking changes! All Zend transformers are now renamed to Laminas.

Transformable

This extension uses transform and reverseTransform methods to convert data to and from the database. This can for example be used to encrypt a field when it's sent to the database and it will be decrypted when it is retrieved from the database.

The field's value will only be transformed when the value changed which also makes it possible to implement only a transform function for one way transformations like hashing.

Currently, these adapters are provided in order of recommendation:

  • HaliteSymmetricTransformer - Encrypt/decrypts the value
  • DefuseCryptoEncryptKeyTransformer - Encrypt/decrypts the value
  • PhpHashTransformer - Hashes the value
  • PhpHmacTransformer - Hashes the value with a key
  • LaminasCryptHashTransformer - Hashes the value
  • LaminasCryptHmacTransformer - Hashes the value with a key
  • LaminasCryptSymmetricTransformer - Encrypts/decrypts the value using openssl (Mcrypt is deprecated), with aes as default algorithm

You can easily create your own transformers by implementing the TransformableInterface

System Requirements

You need:

  • PHP >= 7.3

To use the library.

Install

Install this package by using Composer.

$ composer require mediamonks/doctrine-extensions

Security

If you discover any security related issues, please email devmonk@mediamonks.com instead of using the issue tracker.

Documentation

Please refer to the files in the /doc folder.

Credits

This package was inspired by/uses code from gedmo/doctrine-extensions.

License

The MIT License (MIT). Please see License File for more information.