koriym/json-schema-faker

Generates fake JSON with JSON schema

Maintainers

Package info

github.com/koriym/php-json-schema-faker

pkg:composer/koriym/json-schema-faker

Statistics

Installs: 437 332

Dependents: 1

Suggesters: 0

Stars: 7

Open Issues: 2

0.3.1 2024-10-23 01:14 UTC

This package is auto-updated.

Last update: 2026-03-01 12:21:16 UTC


README

Coding Standards Coding Standards

Generates fake JSON with JSON schema.

  • $ref supported
  • CLI command available

forked from leko/json-schema-faker (deprecated)

Getting started

composer require koriym/json-schema-faker

Usage

$schema = json_decode(file_get_contents(__DIR__ . '/schema.json'));
$fake = (new Faker)->generate($schema);

or

// pass SplFileInfo to support local $ref schema file
$fake = (new Faker)->generate(new SplFileInfo(__DIR__ . '/schema.json'));

Command

// convert all json schema jsons in the directory
./vendor/bin/fakejsons {$soruceDir} {$distDir}