PHP code example of irabbi360 / laravel-attribute-mask
1. Go to this page and download the library: Download irabbi360/laravel-attribute-mask 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/ */
irabbi360 / laravel-attribute-mask example snippets
use Irabbi360\LaravelAttributeMask\Concern\HasMaskedAttributes;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use HasMaskedAttributes;
/**
* Get the attributes that should be masked.
*/
protected function maskables(): array
{
return ['email', 'phone', 'phone_number', 'ssn'];
}
}
class User extends Model
{
use HasMaskedAttributes;
protected array $maskable = ['email', 'phone', 'ssn'];
}
'email_masking' => [
'show_domain' => true, // Show domain part
'show_start' => 2, // Show first 2 characters
'show_end' => 2, // Show last 2 characters
],