PHP code example of cleverage / encryption-bundle

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

    

cleverage / encryption-bundle example snippets



use Doctrine\ORM\Mapping as ORM;

class MyEntity {
    
    /**
     * @ORM\Column(type="encrypt_string") 
     */
    private string $myField;
    
    /**
     * @ORM\Column(type="encrypt_text") 
     */
    private string $myFieldText;
}



// ...
$encryptionEnabler->disableEncryption();

// Starting from here, data will not be decrypted
$encryptionManager->decryptString($value); // The value will not be decrypted
$encryptionManager->encryptString($value); // The value will not be encrypted and store as is

$encryptionEnabler->enableEncryption();
// Now the encryption is re-enabled and works normally


public function registerBundles()
{
    $bundles = array(
        ...
        new Sidus\EncryptionBundle\SidusEncryptionBundle(),
    );

    ...
}