Formatierer & Code
JSON zu PHP-Klasse / DTO
Strict-typed PHP DTO classes from a JSON sample.
Anmerkung der Redaktion
Understanding · Modern PHP DTOs are surprisingly tight.
Dieses ausführliche Kapitel ist derzeit nur auf Englisch verfügbar. Das Konvertierungstool oben funktioniert in Ihrer Sprache; der lange Erklärtext wurde noch nicht übersetzt.
Häufig gestellte Fragen
Quick answers.
›Which version of PHP is supported?
The generator targets PHP 8.1 and above, utilising readonly properties, constructor promotion, and strict type hints. You can manually adjust the output for older versions if required.
›How does it handle nested objects?
Nested JSON objects are automatically identified and generated as separate, linked PHP classes. This maintains a clean, modular structure where each object has its own typed definition.
›Does it support arrays of objects?
Yes. If an array of objects is detected, the tool generates a single class definition for those items and uses array type hinting in the parent class documentation.
›Is my JSON data secure?
Yes. The parsing and transformation happen locally within your browser's memory using JavaScript. Your JSON input and the resulting PHP code are never transmitted to a server.
Andere suchten auch nach
Verwandte Tools
More in this room.
- JSON zu TypeScript-InterfaceTypen aus einem JSON-Beispiel ableiten und TS-Interfaces ausgeben.
- JSON zu C#-KlassePOCO-Klassen aus einem JSON-Beispiel generieren.
- JSON zu Java POJOEin Java POJO aus einem JSON-Beispiel erstellen.
- JSON zu Python DataclassTyp-hinzugefügte Dataclasses (mit optionalem Pydantic) aus JSON.
- JSON zu Go StructIdiomatische Go-Structs mit `json:` Tags.
- JSON zu Kotlin Data ClassPrägnante Data Classes für jedes JSON-Beispiel.