Type generation

JSON to PHP.

Generate modern PHP 8 classes — final readonly with promoted constructor properties — from any JSON document. Typed, nullable-aware, nothing uploaded.

Local · No upload · No size limit on opening · Apache-2.0

Pandia turns a JSON document into modern PHP 8 classes: final readonly classes with constructor property promotion and declare(strict_types=1). Types are inferred (int, string, bool, array), optional fields become nullable with a null default, and nested objects become their own classes.

Example

Input JSON:

{
  "id": 42,
  "name": "Ada",
  "active": true,
  "tags": ["admin", "early"]
}

PHP output:

<?php

declare(strict_types=1);

final readonly class Root
{
    public function __construct(
        public int $id,
        public string $name,
        public bool $active,
        public array $tags
    ) {}
}

What you get

  • Modern final readonly classes with promoted constructor properties.
  • Strict types via declare(strict_types=1).
  • Optional fields inferred as nullable (?T = null).
  • Nested objects become their own classes.

It’s the same engine behind Pandia’s type generation — opinionated, deterministic, and built to run on files far too large for an online converter.

Frequently asked questions

How do I generate PHP classes from JSON?

Open the Types panel in Pandia, choose PHP, and copy the generated classes into your project.

Which PHP version does the output target?

PHP 8.1+ — the output uses readonly classes and constructor property promotion. For older PHP, declare explicit properties and a constructor body instead.

Is anything uploaded, and how big a file can it handle?

Nothing is uploaded — conversion is fully local — and there is no size limit on opening, so multi-gigabyte JSON works fine.

Get Pandia

Stop fighting your JSON.

Download the native app, open your biggest file, and get to work. Free, offline, and open source.