PHP code example of jackprice / doctrine-encrypt

1. Go to this page and download the library: Download jackprice/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/ */

    

jackprice / doctrine-encrypt example snippets




\Doctrine\DBAL\Types\Type::addType(
    \DoctrineEncrypt\Types\Encrypted::ENCRYPTED,
    \DoctrineEncrypt\Types\Encrypted::class
);



$encryptor = new \DoctrineEncrypt\Encryptors\AES256Encryptor(sha1('Use a very strong key here'));
\DoctrineEncrypt\Types\Encrypted::setEncryptor($encryptor);



class MyEntity
{
    /**
     * @ORM\Column(type="encrypted") 
     */
    protected $encrypted;
}