PHP Class to JSON Schema Generator

Need JSON to PHP?

Convert JSON data to PHP code

JSON → PHP Classes

PHP code Input

Loading...

JSON Schema Output

Paste your PHP classes to produce a JSON Schema instantly.

Supports typed properties, DocBlock annotations, nullable/union types, arrays, and associative maps.

Frequently Asked Questions

What PHP syntax is supported?

The converter reads class definitions with typed properties or DocBlock @var annotations, recognizing visibility modifiers, nullable types, arrays, and DateTime/UUID hints. Properties tagged as json-ignore or JsonIgnore are skipped automatically.

How are PHP types mapped to JSON Schema?

string, int, float, bool, array, and custom classes map to their JSON Schema counterparts. Nullable and union types mark fields optional, arrays become schema arrays, and array<string, T> patterns are treated as maps. Unknown classes fall back to string unless another PHP class with that name is defined.

Does it work with frameworks like Laravel or Symfony?

Yes. You can paste DTOs, form requests, or entity classes with typed properties or DocBlock hints. The tool runs entirely in your browser, so your code never leaves your machine.

How can I generate mock JSON data?

After generating the schema, click "Generate Mock Data" to open the Mock Generator with the schema preloaded. Configure locales and options to create sample payloads for docs or tests.