webhubworks/laravel-secure-db-dump
最新稳定版本:1.0.10
Composer 安装命令:
composer require webhubworks/laravel-secure-db-dump
包简介
Allows you to dump your db and anonymize its content.
README 文档
README
Call artisan secure-db-dump:run to export data based on the following config.
Config
Publish the config file via artisan vendor:publish --tag=secure-db-dump-config.
Anonymize fields
This package uses Faker to anonymize fields. You can find the available formatters/methods here: https://fakerphp.org/formatters/
Per field you want to anonymize you have to define the field and a type. Possible values are: faker or static.
Type: static
You will need to provide a value for the field.
Type: faker
You will need to provide a method and optionally args (an array) for the Faker method.
Examples
... 'anonymize_fields' => [ # Specify the table name 'users' => [ # This will run $faker->name() for the 'name' field AnonymizerConfig::make() ->field('name') ->type('faker') ->method('name'), # This will run $faker->email() for the 'email' field AnonymizerConfig::make() ->field('email') ->type('faker') ->method('email'), # This will set the 'password' field to a static value AnonymizerConfig::make() ->field('password') ->type('static') ->value('$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi'), # You can also add (multiple) where conditions. AnonymizerConfig::make() ->field('some_field') ->type('faker') ->method('sentence') ->where('some_field', fn($value) => $value === 'some_value'), ->where('some_other_field', fn($value) => ! str($value)->endsWith('@webhub.de')), ], 'cars' => [ # This will run $faker->regexify('LG [A-Z]{2} [0-9]{2,4}') for the 'licence_plate' field AnonymizerConfig::make() ->field('licence_plate') ->type('faker') ->method('regexify') ->args(['LG [A-Z]{2} [0-9]{2,4}']), ], ], ...
DDEV
In case you get a permission error when trying to CREATE or DROP a database, do the following in the laravel project:
ddev mysql GRANT ALL ON *.* TO 'db'@'%'; FLUSH PRIVILEGES;
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-05-28