Consider that you have example.json
with the following content:
{
"firstName": "Temuri",
"lastName": "Takalandze",
"active": true,
"position": {
"title": "Developer",
"department": {
"title": "IT"
}
}
}
and several POPO classes to represent this JSON data:
Department.php
<?phpclass Department
{
/**
* @var string
*/
private $title; // Getters and Setters here...
}
Position.php
<?phpclass Position
{
/**
* @var string
*/
private $title; /**
* @var \ABGEO\POPO\Example\Department
*/
private $department; // Getters and Setters here...
}
Person.php
<?phpclass Person
{
/**
* @var string
*/
private $firstName; /**
* @var string
*/
private $lastName; /**…
Software Engineer, having over 3 years of experience in Back-End development; The author of several PHP libraries and modules; Open Source Contributor.