Download the PHP package indeev/laravel-rapid-db-anonymizer without Composer
On this page you can find all versions of the php package indeev/laravel-rapid-db-anonymizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download indeev/laravel-rapid-db-anonymizer
More information about indeev/laravel-rapid-db-anonymizer
Files in indeev/laravel-rapid-db-anonymizer
Package laravel-rapid-db-anonymizer
Short Description Rapidly anonymize huge amount of data
License MIT
Homepage https://github.com/indeev/laravel-rapid-db-anonymizer
Informations about the package laravel-rapid-db-anonymizer
Laravel Rapid DB Anonymizer
The package rapidly anonymizes large amounts of sensitive data throughout the database.
Installation
You can install the package through the composer:
Usage
In any model that contains sensitive data use Anonymizable;
trait and const ANONYMIZABLE = [];
constant.
ANONYMIZABLE
is defined as an array of 'column_name' => [what_to_do]
values.
Prepare ANONYMIZABLE constant
Truncate table
Replace column value with faker's provider (without parameters)
Replace column value with faker's provider (with parameters)
Replace with exact value
- if value of setTo is an array type, it is converted to json string. For instance
['foo' => 'bar']
is converted to{"foo":"bar"}
. - if value of setTo is
null
, it is converted to NULL. Pay special attention that column is set as nullable.
Replace also NULL values
By default, NULL values are skipped. If you also want to anonymize them, you must add anonymizeNull
to the column with a value true
.
Run anonymization
To run anonymization for the entire database (all models with Anonymizable trait) use
To run anonymization over a specific model use command with --model=
option
To run anonymizing specific columns in the entire database use command with --columns=
option. Individual column names must be separated by comma
Use a combination of the previous two options to anonymize specific columns above a specific model
Testing
Config
You can export config file by:
In config, you can modify:
- Chunk size (default: 500) - all 500 rows are updated by one query
- Forbidden environments (default: production, prod)
- Custom model directory (default: app/Models)
- Custom model namespace (default: \App\Models)
- Faker's locale _(default: enUS)
Changelog
Please see CHANGELOG for more information 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
- Petr Katerinak
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.