Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Package allows you to create Doctrine entities with fields that will be protected by encryption algorithms such as AES.

License

Notifications You must be signed in to change notification settings

51systems/doctrine-encrypt

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DoctrineEncrypt Build Status

Package encrypts and decrypts Doctrine fields through life cycle events. This version of the Doctrine Encrypt package distinguishes itself with the following features:

  • Superior Annotation parsing & caching using Doctrine's built in libraries for superior performance
  • Totally transparent field encryption: the value will only be encrypted in the database, never in the value
  • Unit testing

Integrations

The package supports the following integrations:

  • Laravel

Upgrading

If you're upgrading from a previous version you can find some help with that in the upgrading guide.

Installation

composer require 51systems/doctrine-encrypt

Configuration

Laravel

Add the subscriber in the boot method of a service provider.

<?php

$encrypter = $this->app->make(\Illuminate\Contracts\Encryption\Encrypter::class);

$subscriber = new DoctrineEncryptSubscriber(
    new \Doctrine\Common\Annotations\AnnotationReader,
    new \DoctrineEncrypt\Encryptors\LaravelEncryptor($encrypter)
);

$eventManager = $em->getEventManager();
$eventManager->addEventSubscriber($subscriber);

Usage

<?php

namespace Your\Namespace;

use Doctrine\ORM\Mapping as ORM;

use DoctrineEncrypt\Configuration\Encrypted;

/**
 * @ORM\Entity
 */
class Entity
{
    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @ORM\Column(type="integer")
     * @var int
     */
    private $id;

    /**
     * @ORM\Column(type="text")
     * @Encrypted
     * @var string
     */
    private $secretData;
}

License

This bundle is under the MIT license.

Versions

I'm using Semantic Versioning like described here.

About

Package allows you to create Doctrine entities with fields that will be protected by encryption algorithms such as AES.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%