1. Go to this page and download the library: Download temper/laravel-dbmask 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/ */
temper / laravel-dbmask example snippets
'users' => [
// id will be ns can be used to mask data
'email' => "concat(md5('id'),'@example.com')",
// A non-associative array value will be sing the last_name column as a hash seed
'last_name' => DBMask::random('last_name', 'english_last_names'),
// Uses the application key to replace the value with a new generated password hash
// In this case, all users end up with their password set to the bcrypt hashed value of `secret`.
'password' => DBMask::bcrypt('secret'),
]
// exclude records of people born after 2000
'users' => 'birth_date < 2000-01-01',
//
$faker = Faker\Factory::create('nl_NL');
'tables' => [
'users' => [
'social_security_num' => DBMask::random('social_security_num', 'ssn')
]
]
'mask_datasets' => [
// generates a set of form-validatable social security numbers
'ssn' => DBMask::generate(100, function() use ($faker) {
return $faker->unique()->idNumber;
}),
]