laravel-data-anonymization maintained by arrilot
Description
Laravel bridge for arrilot/data-anonymization
Author
Last update
2020/11/08 08:19 (dev-master)
License
Downloads
373 053
Tags
Last update
2020/11/08 08:19
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support >=8.0
- illuminate/contracts >=8.0
- illuminate/console >=8.0
Last update
2020/10/11 19:12
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support >=8.0
- illuminate/contracts >=8.0
- illuminate/console >=8.0
Last update
2020/10/11 17:57
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support >=5.5
- illuminate/contracts >=5.5
- illuminate/console >=5.5
Last update
2020/04/19 08:30
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*|6.*|7.*
- illuminate/contracts 5.*|6.*|7.*
- illuminate/console 5.*|6.*|7.*
Last update
2019/10/13 22:17
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*|6.*
- illuminate/contracts 5.*|6.*
- illuminate/console 5.*|6.*
Last update
2019/10/13 22:02
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*|6.*
- illuminate/contracts 5.*|6.*
- illuminate/console 5.*|6.*
Last update
2019/08/08 22:11
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*
- illuminate/contracts 5.*
- illuminate/console 5.*
Last update
2019/02/05 22:02
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*
- illuminate/contracts 5.*
- illuminate/console 5.*
Last update
2018/06/21 23:01
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*
- illuminate/contracts 5.*
- illuminate/console 5.*
Last update
2015/11/23 16:16
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*
- illuminate/contracts 5.*
- illuminate/console 5.*
Last update
2015/11/22 22:16
License
Require
- php >=5.5.9
- arrilot/data-anonymization ~1.0
- illuminate/support 5.*
- illuminate/contracts 5.*
- illuminate/console 5.*
comments powered by Disqus
- This is a bridge package for a full integration of arrilot/data-anonymization into Laravel framework.
-
composer require arrilot/laravel-data-anonymization
-
Add
"Database\\Anonymization\\": "database/anonymization/",
tocomposer.json -> autoload -> psr-4
-
php artisan anonymization:install
The package is designed to be as much consistent with Laravel built-in seeders as possible.
php artisan anonymization:install
creates two files:
database/anonymization/DatabaseAnonymizer.php
<?php
namespace Database\Anonymization;
use Arrilot\LaravelDataAnonymization\AbstractAnonymizer;
class DatabaseAnonymizer extends AbstractAnonymizer
{
/**
* Run the database anonymization.
*
* @return void
*/
public function run()
{
$this->call(UserTableAnonymizer::class);
}
}
database/anonymization/UserTableAnonymizer.php
<?php
namespace Database\Anonymization;
use Arrilot\DataAnonymization\Blueprint;
use Arrilot\LaravelDataAnonymization\AbstractAnonymizer;
use Faker\Generator as Faker;
class UsersAnonymizer extends AbstractAnonymizer
{
/**
* Run the database anonymization.
*
* @return void
*/
public function run()
{
// For more info about this part read here https://github.com/arrilot/data-anonymization
$this->table('users', function (Blueprint $table) {
$table->column('email')->replaceWith(function(Faker $faker) {
return $faker->unique()->email;
});
$table->column('name')->replaceWith('John Doe');
});
}
}
DatabaseAnonymizer
is an entry point into anonymization. It runs other anonymizers.
UsersAnonymizer
is a useful built-in example. You can modify it and create other anonymizers for other tables using generator.
php artisan make:anonymizer AccountsAnonymizer
. Similar to make:seeder
Anonymization is performed using php artisan db:anonymize
command.
Its signature is identical with db:seed
command.