Typed PropertiesConstructor100% Private
<?php
class Root
{
public int $id;
public string $name;
public string $email;
public bool $active;
public float $score;
public Address $address;
public array $tags;
public function __construct(
int $id,
string $name,
string $email,
bool $active,
float $score,
Address $address,
array $tags
) {
$this->id = $id;
$this->name = $name;
$this->email = $email;
$this->active = $active;
$this->score = $score;
$this->address = $address;
$this->tags = $tags;
}
}
class Address
{
public string $street;
public string $city;
public function __construct(
string $street,
string $city
) {
$this->street = $street;
$this->city = $city;
}
}FAQ
What PHP version is the output for?
The output uses typed properties (PHP 7.4+) and constructor promotion patterns compatible with PHP 8.0+.
Are nested objects handled?
Yes. Nested JSON objects generate separate PHP class definitions with proper type hints.
Is a constructor generated?
Yes. Each class includes a constructor that accepts all properties as parameters and assigns them to the class fields.
Love this tool? Explore 999+ more
Free online tools for images, PDFs, text, code, and more. All running in your browser.
Explore All Tools