PHP code example of lucascardoso-egsys / doctrine-encrypt
1. Go to this page and download the library: Download lucascardoso-egsys/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/ */
lucascardoso-egsys / doctrine-encrypt example snippets
$subscriber = new DoctrineEncryptSubscriber(
new \Doctrine\Common\Annotations\AnnotationReader,
new \DoctrineEncrypt\Encryptors\OpenSslEncryptor("contentPrivateKeyRSA2048Generated", "contentPublicKey2048Generated", "passwordKeyRsa", "ivBase64")
);
$eventManager = $em->getEventManager();
$eventManager->addEventSubscriber($encrypt_subscriber);
namespace Your\CoolNamespace;
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
*/
protected $id;
/**
* @ORM\Column(type="text")
* @Encrypted
* @var string
*/
protected $secret_data;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.