PHP code example of arrilot / data-anonymization
1. Go to this page and download the library: Download arrilot/data-anonymization library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
arrilot / data-anonymization example snippets
#!/usr/bin/env php
use Arrilot\DataAnonymization\Anonymizer;
use Arrilot\DataAnonymization\Blueprint;
use Arrilot\DataAnonymization\Database\SqlDatabase;
r($database);
// Describe `users` table.
$anonymizer->table('users', function (Blueprint $table) {
// Specify a primary key of the table. An array should be passed in for composite key.
// This step can be skipped if you have `id` as a primary key.
// You can change default primary key for all tables with `Blueprint::setDefaultPrimary('ID')`
$table->primary('id');
// Replace with static data.
$table->column('email1')->replaceWith('[email protected]');
// Use #row# template to get "[email protected]", "[email protected]", "[email protected]"
$table->column('email2')->replaceWith('email_#row#@example.com');
// To replace with dynamic data a $generator is needed.
// Any generator object can be set like that - `$anonymizer->setGenerator($generator);`
// A simpler way is just to do `