Dump masked information from your database

Overview

Laravel Masked DB Dump

A database dumping package that allows you to replace and mask columns while dumping your database.

Latest Version on Packagist Total Downloads

Installation

You can install the package via composer:

composer require beyondcode/laravel-masked-db-dump

Documentation

The documentation can be found on our website.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Comments
  • Add support for PHP 8

    Add support for PHP 8

    This was my original intention for forking the repo, but when I tried to run the tests I got the errors, so I made this PR https://github.com/beyondcode/laravel-masked-db-dump/pull/5

    Now I've successfully run the tests on PHP 8 and everything seems fine.

    opened by mokhosh 4
  • Feature request: Ability to order tables

    Feature request: Ability to order tables

    It would be great to be able to set certain tables to be at the start of the sql file, so that when importing, foreign key checks don't fail.

    Many thanks for an amazing package. If I can I will try to submit PR for this.

    opened by admench 2
  • Added support of mask on the table level

    Added support of mask on the table level

    Without this change, the documentation example works incorrectly: dumps the DB but doesn't use the correct mask character.

    return [
        'default' => DumpSchema::define()
            ->table('users', function ($table) {
                $table->mask('password', '-');
            })
    ];
    
    opened by PovilasKorop 2
  • Has this package been abandoned?

    Has this package been abandoned?

    Judging from the last commit date, the lack of comments on the issues and replies to the pull requests, I'd believe this package to be abandoned? I'd love to contribute, but if it's abandoned it'll do no good.

    opened by lasseeee 1
  • Fix tests

    Fix tests

    Currently if you try to run the tests you get this error:

    BeyondCode\LaravelMaskedDumper\Tests\DumperTest::it_can_dump_certain_tables_as_schema_only
    Symfony\Component\Console\Exception\CommandNotFoundException: The command "db:dump" does not exist.
    

    Because the actual command has been renamed from db:dump to db:masked-dump but the tests weren't updated.

    After fixing that if you run the tests you get this one:

    BeyondCode\LaravelMaskedDumper\Tests\DumperTest::it_can_replace_columns_with_faker_values
    ArgumentCountError: Too few arguments to function BeyondCode\LaravelMaskedDumper\Tests\DumperTest::BeyondCode\LaravelMaskedDumper\Tests\{closure}(), 1 passed and exactly 2 expected
    

    Because in it_can_replace_columns_with_faker_values we're receiving a $faker as dependency but we're never passing it in DumpSchema.php, and if we add that we become green.

    opened by mokhosh 1
  • add support for serializable config

    add support for serializable config

    This PR adds support for serializable cached config using PHP callables. Callables can be used to pass a callable class to the config array which is serialized to the cache, then called as a callable function on run-time.

    Also incorporates @crezra's support for Laravel 9

    For example:

    // config/masked-dump.php
    ...
      'default' => [MaskedDump::class, 'define'],
    ...
    
    // app/Support/MaskedDump.php
    
    class MaskedDump
    {
      public static function define()
      {
        return DumpSchema::define()->allTables();
      }
    }
    
    opened by kswilliames 1
  • Can't restore dumps on PostgreSQL

    Can't restore dumps on PostgreSQL

    Trying to restore a dump created with the package on a PostgreSQL server doesn't work and produces a lot of errors.

    Here's a snippet:

    CREATE TABLE
    ERROR:  syntax error at or near "`"
    LINE 1: LOCK TABLES `sandbox_documents` WRITE;
                        ^
    ERROR:  syntax error at or near "`"
    LINE 1: ALTER TABLE `sandbox_documents` DISABLE KEYS;
                        ^
    ERROR:  syntax error at or near "`"
    LINE 1: ALTER TABLE `sandbox_documents` ENABLE KEYS;
    

    The relevant SQL in the generated dump:

    LOCK TABLES `sandbox_documents` WRITE;
    ALTER TABLE `sandbox_documents` DISABLE KEYS;
    ALTER TABLE `sandbox_documents` ENABLE KEYS;
    

    PostgreSQL uses double quote for escaping keywords and not back quote.

    opened by gjm 0
  • Config is no longer serializable after installing this package

    Config is no longer serializable after installing this package

    Thanks for such a great package. It works a charm.

    However I cannot run php artisan config:cache when this is installed, I get this issue:

    LogicException 
    
    Your configuration files are not serializable.
    
     at vendor/laravel/framework/src/Illuminate/Foundation/Console/ConfigCacheCommand.php:71
        67|             require $configPath;
        68|         } catch (Throwable $e) {
        69|             $this->files->delete($configPath);
        70| 
      > 71|             throw new LogicException('Your configuration files are not serializable.', 0, $e);
        72|         }
        73| 
        74|         $this->info('Configuration cached successfully!');
        75|     }
    
      1   bootstrap/cache/config.php:734
          Error::("Call to undefined method BeyondCode\LaravelMaskedDumper\DumpSchema::__set_state()")
    
          [2m+14 vendor frames [22m
      16  artisan:37
          Illuminate\Foundation\Console\Kernel::handle()
    

    Any tips to overcome this would be greatly appreciated.

    Using v1.0.0 on Laravel 7.30.4

    opened by admench 3
  • Add two new features: 1) exclude($tableName) 2) outputInChunksOf($chunkSize)

    Add two new features: 1) exclude($tableName) 2) outputInChunksOf($chunkSize)

    Hi,

    I have added two new features.

    1. Ability to exclude a table from the export:

    Sometimes you might not want to include all tables in the export. You can achieve this with:

    return [
        'default' => DumpSchema::define()
                        ->allTables()
                        ->exclude('password_resets')
                        ->exclude('migrations');
    ];
    
    1. Ability to create INSERTs with multiple rows

    When you have a table with many rows (1000+) creating INSERT statements for each row results in a very slow import process. For these cases it is better to create INSERT statements with multiple rows.

    You can achieved this with ->outputInChunksOf($n).

    return [
        'default' => DumpSchema::define()
            ->allTables(),
            ->table('users', function($table) { 
                    return $table->outputInChunksOf(25); 
                });
    ];
    

    Tests

    • I have fixed the existing tests (they used artisan db:dump instead of db:masked-dump)
    • I have added a test for exclude()
    • I have added a test for outputInChunksOf()

    Documentation

    I have added two sections describing the features in the Readme.md file.

    Liebe Grüße Alex

    PS: It's my first pull request ever for an open source project ... so I hope I didn't miss anything :) PPS: Thank you for all the great work and stuff you are providing!

    opened by k2idev 0
  • Large Database - inefficient dump format

    Large Database - inefficient dump format

    the dump file does not group imports, so one insert statement for each line.

    Workaround:

    import dump locally, then export again using e.g. Sequel Ace

    Would be great if the dump format could be optimized

    opened by cord 0
Releases(1.0.0)
Owner
Beyond Code
Beyond Code
CRUD Build a system to insert student name information, grade the class name, and edit and delete this information

CRUD Build a system to insert student name information, grade the class name, and edit and delete this information

Sajjad 2 Aug 14, 2022
Find forgotten variables dump in PHP source code.

PHP VarDump Check This repository is abandoned. Suggested alternative: https://github.com/php-parallel-lint/PHP-Var-Dump-Check PHP console application

Jakub Onderka 27 Jul 13, 2022
Find forgotten variables dump in PHP source code.

PHP VarDump Check PHP console application for find forgotten variable dump. Support PHP build in method print_r, var_dump and var_export method and al

PHP Parallel lint 13 Jul 13, 2022
A web application built on PHP for user to view their credit information in their mysql database

TheCreditInfo Table of Content About Inspiration Technologies Client Pages Usage About Credere is a website created to help you track your credit hist

Abdul-Baseet Shabi 0 Jul 21, 2022
Allow any Discord user to sign in to your website and save their discord user information for later use.

Simple Discord SSO ( Single Sign-On ) Requires at least: 5.0 Tested up to: 5.8.3 Stable tag: 1.0.2 Requires PHP: 7.4 License: GPLv2 or later License U

null 2 Oct 7, 2022
This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

PHP-introduction This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

Tyler Jacques 1 Jan 6, 2022
A PHP MySQL database client class to simplify database access

This lightweight database class is written with PHP and uses the MySQLi extension, it uses prepared statements to properly secure your queries, no need to worry about SQL injection attacks.

Khader Handal 50 Jul 30, 2022
LaraNx Seo enables your Laravel app to store SEO and social media meta tag data in database instead of your code

LaraNx Seo enables your Laravel app to store SEO and social media meta tag data in database instead of your code. Moving marketing data out of your code base and into your database where it is easily modified.

srg 13 Dec 29, 2022
run user analytics within your system and track user data inside your database.

WP Local Analytics plugin. run user analytics within your system and track user data inside your database. Installing Go to the plugin page from the W

Gary 5 Dec 21, 2022
WP Local Analytics plugin. - run user analytics within your system and track user data inside your database.

WP Local Analytics plugin. - run user analytics within your system and track user data inside your database.

Gary 5 Dec 21, 2022
Extracts information about web pages, like youtube videos, twitter statuses or blog articles.

Essence is a simple PHP library to extract media information from websites, like youtube videos, twitter statuses or blog articles. If you were alread

Essence 765 Dec 30, 2022
Michael Pratt 307 Dec 23, 2022
Fact Extraction and VERification Over Unstructured and Structured information

Repository for Fact Extraction and VERification Over Unstructured and Structured information (FEVEROUS), used for the FEVER Workshop Shared Task at EMNLP2021.

Rami 49 Dec 9, 2022
PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

php-text-analysis PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP l

null 464 Dec 28, 2022
Add information about PGP public keys on upload in Kirby v3

Kirby3 GnuPG This plugin adds information about PGP public keys on upload, using gpg binary (which needs to be installed for this to work). Getting st

Fundevogel 2 Oct 11, 2021
Here is an Instagram Guest API. Gather all public information as JSON format without logging yourself.

Here is an Instagram Guest API. Gather all public information as JSON format without logging yourself. It's all automation and time saving.

Quatrecentquatre 1 Nov 2, 2021
This is a PHP library developed for Symfony to collect address information.

Goldbach Algorithms Address Info Getter (fondly nicknamed AIG) is a PHP library developed for Symfony to collect address information.

Goldbach Algorithms 1 Nov 3, 2021
This is the information I prepared for the PHP interview.The notes include PHP, MySql, Linux, etc.

PHP面试准备的资料 这个项目是自己准备面试整理的资料。可能包括PHP、MySQL等资料。方便自己以后查阅,会不定期更新,如果错误,请指出,谢谢。欢迎大家提交PR,谢谢大家的star 可以通过https://xianyunyh.gitbooks.io/php-interview/预览。欢迎有精力的朋

Troy 1.2k Dec 24, 2022
YogsMAP adalah GIS(Geographic Information System) yang dibangun dengan PHP Native, MapBox API dan Boostrap

YogsMAP adalah GIS(Geographic Information System) yang dibangun dengan PHP Native, MapBox API dan Boostrap. Website ini menampilkan data pada area di yogyakarta, serta bisa menampilkan lokasi-lokasi yang diinginkan.

Krisna Dewa 3 Nov 18, 2022