/muse

Inspires some JSON data basing itself on a JSON schema

Primary LanguagePHP

Muse

Build Status

The Muse inspires itself from a JSON Schema (only wth JSON Schema v4 for now) to generate a valid JSON.

Usage

$schema = <<<SCHEMA
{
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    }
  }
}
SCHEMA;


echo "Dumb data provider\n";
echo \Muse\MuseFactory::createDumbMuse()->inspire($schema);

echo "\n\n";
echo "Random data provider\n";
echo \Muse\MuseFactory::createRandomMuse()->inspire($schema);

will output:

Dumb data provider
{
    "id": 1,
    "name": "foo"
}

Random data provider
{
    "id": 1634388030,
    "name": "ajkvu5xpepkwwc04skkw4wgs0s4ok48"
}