PHP code example of 51systems / doctrine-encrypt
1. Go to this page and download the library: Download 51systems/doctrine-encrypt library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
51systems / doctrine-encrypt example snippets
$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);
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;
}