PHP code example of webhubworks / laravel-secure-db-dump
1. Go to this page and download the library: Download webhubworks/laravel-secure-db-dump 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/ */
webhubworks / laravel-secure-db-dump example snippets
...
'anonymize_fields' => [
# Specify the table name
'users' => [
# This will run $faker->name() for the 'name' field
AnonymizerConfig::make()
->field('name')
->type('faker')
->method('name'),
# This will run $faker->email() for the 'email' field
AnonymizerConfig::make()
->field('email')
->type('faker')
->method('email'),
# This will set the 'password' field to a static value
AnonymizerConfig::make()
->field('password')
->type('static')
->value('$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'),
# You can also add (multiple) where conditions.
AnonymizerConfig::make()
->field('some_field')
->type('faker')
->method('sentence')
->where('some_field', fn($value) => $value === 'some_value'),
->where('some_other_field', fn($value) => ! str($value)->endsWith('@webhub.de')),
],
'cars' => [
# This will run $faker->regexify('LG [A-Z]{2} [0-9]{2,4}') for the 'licence_plate' field
AnonymizerConfig::make()
->field('licence_plate')
->type('faker')
->method('regexify')
->args(['LG [A-Z]{2} [0-9]{2,4}']),
],
],
...
bash
ddev mysql
GRANT ALL ON *.* TO 'db'@'%';
FLUSH PRIVILEGES;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.