This package is a fork of masked-db-dump, A database dumping package that allows you to replace and mask columns while dumping your database.
You can install the package via composer:
composer require alializade/laravel-masked-db-dump
Use this dump schema definition to remove, replace or mask certain parts of your database tables.
use AliAlizade\LaravelMaskedDumper\DumpSchema;
use AliAlizade\LaravelMaskedDumper\TableDefinitions\TableDefinition;
use Faker\Generator as Faker;
class CoreServiceProvider extends ServiceProvider
{
// ...
public function boot(): void
{
//...
$this->app->singleton('masked_dump_default', function () {
return DumpSchema::define('mysql')
->allTables()
->table('users', function (TableDefinition $table) {
$table->replace('name', function (Faker $faker) {
return $faker->name;
});
$table->replace('email', function (Faker $faker) {
return $faker->lastName().'@fake.com';
});
$table->replace('password', function (Faker $faker) {
return $password = bcrypt('secret');
});
})
->schemaOnly('personal_access_tokens')
});
// ...
}
$ php artisan db:masked-dump output.sql
$ php artisan db:masked-dump output.sql --gzip
The documentation can be found on the website.
If you discover any security related issues, please email ali.alizade@outlook.com instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.