alializade/laravel-masked-db-dump

Dump masked information from your database
4,342
Install
composer require alializade/laravel-masked-db-dump
Latest Version:1.0.10
PHP:^8.0
Laravel:10
License:MIT
Last Updated:Sep 26, 2023
Links: GitHub  ·  Packagist
Maintainer: alializade

Laravel Masked DB Dump

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.

Installation

You can install the package via composer:

composer require alializade/laravel-masked-db-dump

Usage

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

Documentation

The documentation can be found on the website.

Security

If you discover any security related issues, please email ali.alizade@outlook.com instead of using the issue tracker.

License

The MIT License (MIT). Please see License File for more information.

Related Packages

beyondcode/laravel-masked-db-dump

Dump masked information from your database

58,424 114
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

641,106,524 9,700
laravel/framework

The Laravel Framework.

593,882,149 34,959
laravel/tinker

Powerful REPL for the Laravel framework.

502,645,077 7,441
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

418,291,778 609

Version History

Version Released PHP Laravel License
1.0.10 ^8.0 ^10.0 MIT
1.0.9 ^8.0 ^10.0 MIT
1.0.8 ^8.0 ^10.0 MIT
1.0.6 ^8.0 ^10.0 MIT
1.0.5 ^8.0 ^10.0 MIT