emanueleminotto / json-schema-faker
Faker provider for JSON Schema
1.0.0
2019-07-05 19:13 UTC
Requires
- php: ~7.1
- fzaninotto/faker: ^1.8
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- opis/json-schema: ^1.0.15
- phpunit/phpunit: >=7.0
This package is auto-updated.
Last update: 2024-10-29 05:11:00 UTC
README
Utility based on fzaninotto/Faker to generate fake JSON starting from a JSON Schema.
Structure
If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.
bin/
config/
src/
tests/
vendor/
Install
Via Composer
$ composer require emanueleminotto/json-schema-faker
Usage
$faker = Faker\Factory::create(); $faker->addProvider(new EmanueleMinotto\JsonSchemaFaker\JsonSchemaProvider()); $schema = '{ "type": "array", "items": [ {"type": "integer"}, {"type": "string"} ] }'; $data = $faker->jsonSchemaContent($schema); // $data = $faker->jsonSchema(json_decode($schema, true)); var_dump($data); /* array(2) { [0]=> int(2336562738116576768) [1]=> string(62) "Officiis qui officiis quasi. Sed et dolorem omnis repellendus." } */
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email minottoemanuele@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.