joonas1234 / laravel-anonymize-db
Anonymize-db is Laravel package that replaces sensitive date with fake data
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Type:project
pkg:composer/joonas1234/laravel-anonymize-db
Requires
- php: ^7.2|^8.0
- fzaninotto/faker: ^1.4
- laravel/framework: ^5.8|^6.0|^7.0|^8.0
This package is auto-updated.
Last update: 2025-10-04 13:49:15 UTC
README
Installation
composer require --dev joonas1234/laravel-anonymize-db
Publish the config:
php artisan vendor:publish --tag=config --provider=Joonas1234\\LaravelAnonymizeDB\\AnonymizeDBServiceProvider
This will create config\anonymize-db.php file for you.
You can use this file to configure which columns should be anonymized
Config consists of tables and fakerProviders arrays. tables is used to define which tables and columns should be anonymized.
For example if you want to anonymize register numbers and owner names in cars -table, you can do it like this:
<?php
return [
'tables' => [
'cars' => [
'register_number' => 'vehicleRegistration',
'owner_name' => 'name',
],
],
'fakerProviders' => [
'Fakecar'
]
]
It is required to add FakeCar to fakerProviders so faker can utilize vehicleRegistration from Fakecar.
Modifiers
You can also use Faker's special providers: unique(), optional() and valid():
<?php
return [
'tables' => [
'users' => [
'email' => 'email|unique',
],
],
]
Command to anonymize
php artisan db:anonymize