PHP code example of indeev / laravel-rapid-db-anonymizer

1. Go to this page and download the library: Download indeev/laravel-rapid-db-anonymizer 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/ */

    

indeev / laravel-rapid-db-anonymizer example snippets


class Customer 
{
    use Anonymizable;

    const ANONYMIZABLE = [
        'name' => [
            'faker' => ['provider' => 'firstName'],
        ],
    ];
    // ...
}

const ANONYMIZABLE = ['truncate'];

const ANONYMIZABLE = [
        'name' => [
            'faker' => ['provider' => 'firstName'],
        ],
        // next columns
    ];
 

const ANONYMIZABLE = [
        'secret_code' => [
            'faker' => ['provider' => 'randomNumber', 'params' => [6, true]],
        ],
        // next columns
    ];
 

const ANONYMIZABLE = [
        'favorite_politician' => [
            'setTo' => 'CONFIDENTIAL',
        ],
        'favorite_numbers' => [
            'setTo' => [7, 13],
        ],
        'favorite_meals' => [
            'setTo' => null,
        ],
        // next columns
    ];
 

const ANONYMIZABLE = [
        'shipping_address' => [
            'faker' => ['provider' => 'address'],
            'anonymizeNull' => true,
        ],
        // next columns
    ];
 

php artisan vendor:publish --provider="Indeev\LaravelRapidDbAnonymizer\LaravelRapidDbAnonymizerServiceProvider"
cmd
php artisan db:anonymize
cmd
php artisan db:anonymize --model=\\App\\Models\\VerificationCode
cmd
php artisan db:anonymize --columns=name,surname
cmd
php artisan db:anonymize --model=\\App\\Models\\User --columns=name,surname