PHP code example of joelwmale / laravel-encryption
1. Go to this page and download the library: Download joelwmale/laravel-encryption 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/ */
joelwmale / laravel-encryption example snippets
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Joelwmale\LaravelEncryption\Traits\EncryptsAttributes;
class User extends Model
{
use EncryptsAttributes;
protected $encryptableAttributes = [
'first_name',
'last_name',
'date_of_birth',
'email_verified_at',
];
protected $encryptableCasts = [
'date_of_birth' => 'date',
'email_verified_at' => 'datetime'
];
}
return [
/**
* Enable or disable the encryption.
*/
'enabled' => env('LARAVEL_ENCRYPTION_ENABLED', true),
/**
* The encryption key.
*
* Default: your app key.
*/
'key' => env('LARAVEL_ENCRYPTION_KEY', null),
/**
* The encryption cipher.
*
* Supports any cipher method supported by openssl_get_cipher_methods().
*
* Default: AES-256-CBC.
*/
'cipher' => env('LARAVEL_ENCRYPTION_CIPHER', 'AES-256-CBC'),
];