PHP code example of emanueleminotto / json-schema-faker
1. Go to this page and download the library: Download emanueleminotto/json-schema-faker 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/ */
emanueleminotto / json-schema-faker example snippets
$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."
}
*/