PHP code example of bjornvoesten / laravel-ciphersweet
1. Go to this page and download the library: Download bjornvoesten/laravel-ciphersweet 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/ */
bjornvoesten / laravel-ciphersweet example snippets
use HasEncryption;
/**
* The attributes that can be encrypted.
*
* @var array
*/
protected $encrypted = [
'social_security_number',
];
/**
* Set the social security number attribute encryption.
*
* @param \Bjornvoesten\CipherSweet\Contracts\Attribute $attribute
* @return void
*/
public function socialSecurityNumberAttributeEncryption($attribute): void
{
$attribute
->index('social_security_number_full_index', function (Index $index) {
$index
->bits(32)
->slow();
})
->index('social_security_number_last_four_index', function (Index $index) {
$index
->bits(16)
->transform(
new LastFourDigits()
);
});
}