koriym / json-schema-faker
使用 JSON schema 生成假 JSON
0.3.0
2024-08-16 02:48 UTC
Requires
- php: >=7.1.0
- ext-json: *
- ext-mbstring: *
- fakerphp/faker: ^1.13
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.17
- justinrainbow/json-schema: ^5.2.8
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-16 03:01:04 UTC
README
使用 JSON schema 生成假 JSON。
$ref
支持- 可用 CLI 命令
从 leko/json-schema-faker 分支 (已弃用)
入门
composer require koriym/json-schema-faker
用法
$schema = json_decode(file_get_contents(__DIR__ . '/schema.json')); $fake = (new Faker)->generate($schema);
或
// pass SplFileInfo to support local $ref schema file $fake = (new Faker)->generate(new SplFileInfo(__DIR__ . '/schema.json'));
命令
// convert all json schema jsons in the directory
./vendor/bin/fakejsons {$soruceDir} {$distDir}