PHP code example of gestazion / aesencrypt

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

    

gestazion / aesencrypt example snippets


composer 

namespace App\Models;

use Gestazion\AESEncrypt\Database\Eloquent\ModelEncrypt;

class Person extends ModelEncrypt
{
    /**
     * The attributes that are encrypted.
     *
     * @var array<int, string>
     */
    protected $fillableEncrypt = [
        'name'
    ];

}

    Schema::create('persons', static function (Blueprint $table) {
        // Here you do all columns supported by the schema builder
        $table->id();
        $table->string('description', 250)->nullable();
        $table->timestamps();

        // This is used to add BLOB type into database
        $table->binary('name');
    });

    // once the table is created use a raw query to ALTER it and add the MEDIUMBLOB or LONGBLOB
    DB::statement("ALTER TABLE persons ADD name MEDIUMBLOB after id");

AES_ENCRYPT_KEY=yourencryptedkey
AES_ENCRYPT_MODE=aes-256-cbc
bash
php artisan vendor:publish --provider="Gestazion\AESEncrypt\AesEncryptServiceProvider"