1. Go to this page and download the library: Download williamrox45/encrypt-model 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/ */
williamrox45 / encrypt-model example snippets
use William\EncryptModel\EncryptModel;
class User extends Authenticatable
{
use HasFactory;
use Notifiable;
use SoftDeletes;
use EncryptModel; // <------
/**
* Attributes that should be encrypted
* @var array<int, string>
*/
protected $encryptable = [
'name',
'email',
];
$user = new User();
$user->name = "William";
$user->email = "[email protected]";
dump($user);
/**
* These values will be save like this in the database
*
* name = eyJpdiI6ImxyeVRBMGZrdGV2TDE1N1BkdzhRbFE9PSIsInZhbHVlIjoiUEd0QjlNbzNLMDBidXYySUtnRHB4dz09IiwibWFjIjoiMWY2ZDhjZjVhMmY5Mzk1ZGJlZDlhZWEyODk1ODg4NzIzOTdlZWE5MGY3ODhjNmM1ZDUzOGY2MzM5ZjEzOWI3YSIsInRhZyI6IiJ9
* email = eyJpdiI6InhqamlKQVIxalFEdFNuRDZqNnZZTHc9PSIsInZhbHVlIjoicmgrMktBcDJwUllvZzFEZ3h6VDd3dlhKZXBPSWNuMi9TcHYrYnBZb2wrVT0iLCJtYWMiOiI2MGM0YmI5Mzc1ZjkxZjFkY2VkNDE3MzIwZDRjYjQ5ODc4ZDc1N2JjYTU2MmExNGNkYTlmZjk3NTU4ODM1Y2M5IiwidGFnIjoiIn0
*/
dd($user->name, $user->email);
/**
* name = William
* email = [email protected]
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.