insitaction/field-encrypt-bundle

Allows automatic encryption of fields, as required by GDPR.

Installs: 4 494

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 1

Forks: 0

Type:symfony-bundle

3.0.5 2023-12-04 10:19 UTC

This package is auto-updated.

Last update: 2024-04-04 13:36:35 UTC


README

Insitaction

Field Encrypt

Field Encrypt is a symfony bundle which allows to encrypt the fields in the database as required by the GDPR.

Installation:

composer require insitaction/field-encrypt-bundle 

Environment:

You must define the ENCRYPT_KEY var in your .env file.

The ENCRYPT_KEY must be an aes-256-cbc key with the 32 first characters.

Usage:

You must add the EncryptedString::ENCRYPTED_STRING type attribute to the field you want to encrypt/decrypt.

Let's see an example:

<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Insitaction\FieldEncryptBundle\Doctrine\DBAL\Types\EncryptedString;

class MyEntity
{

    #[ORM\Column(type: EncryptedString::ENCRYPTED_STRING, unique: true)]
    private mixed $myPrivateEncryptedField;
    
    #[ORM\Column(type: 'string', unique: true)]
    private string $email;

    public function getUniqueIdentifier(): string
    {
        return $this->email;
    }
}

That's else !