PHP code example of xorgxx / doctrine-encryptor-bundle

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

    

xorgxx / doctrine-encryptor-bundle example snippets



  use DoctrineEncryptor\DoctrineEncryptorBundle\Attribute\NeoxEncryptor;
  ....
  
    #[ORM\Column(type: Types::TEXT, nullable: true)]
    #[neoxEncryptor(build: "out", facker : )]
    private ?string $content = null;

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    #[neoxEncryptor(build: "in")]
    private ?string $description = null;
 
    
    /** =======   note that by default #[neoxEncryptor] 
    * Attribute : build: "in". be default  in / out
    * Attribute : facker: PhoneFacker::class. be default This give possibility to customize the "facker" for ex: type phoneNumber it's not buildin bundle, but hee you can make service.
    **/
 
  ....


  #[neoxEncryptor]
  #[ORM\Column(length: 20)]
  private ?string $name = null;
  
  "john doe" <- decrypt (length:8) ✅  / ⛔ (length: +20!!) encrypt -> "MUIFAOpLp21iX1Dy2ZNkYbby6zo7ADYgVs-hGkNaWR2OF5AbQUMcBKZHigtFVxZiIFWyOTV8Ts-9q_pNAHBxCKcAPZNJjfPgVQglMLAKi0bZicmPlCQKJpRpX2k5IAjAqawOlFsPpD9KikIEFRhuy"
  
`
    
      namespace App\Services;
      use libphonenumber\PhoneNumber;
      class PhoneFacker implements neoxFackerInterface
      {
          public function create( ): PhoneNumber
          {
              return  (new PhoneNumber())
                  ->setCountryCode(33)
                  ->setNationalNumber("14155552671")
              ;
          }
      }