22
33Fill Plain Old PHP Object with JSON content.
44
5- [ ![ Build Status] ( https://travis-ci.com/ABGEO07/json-to-popo.svg?branch=master )] ( https://travis-ci.com/ABGEO07/json-to-popo )
6- [ ![ Coverage Status] ( https://coveralls.io/repos/github/ABGEO07/json-to-popo/badge.svg?branch=master )] ( https://coveralls.io/github/ABGEO07/json-to-popo?branch=master )
5+ [ ![ Build Status] ( https://travis-ci.com/ABGEO07/json-to-popo.svg?branch=1.x )] ( https://travis-ci.com/ABGEO07/json-to-popo?branch=1.x )
6+ [ ![ Coverage Status] ( https://coveralls.io/repos/github/ABGEO07/json-to-popo/badge.svg?branch=1.x )] ( https://coveralls.io/github/ABGEO07/json-to-popo?branch=1.x )
77[ ![ GitHub release] ( https://img.shields.io/github/release/ABGEO07/json-to-popo.svg )] ( https://github.com/ABGEO07/json-to-popo/releases )
88[ ![ Packagist Version] ( https://img.shields.io/packagist/v/abgeo/json-to-popo.svg )] ( https://packagist.org/packages/abgeo/json-to-popo )
99[ ![ GitHub license] ( https://img.shields.io/github/license/ABGEO07/json-to-popo.svg )] ( https://github.com/ABGEO07/json-to-popo/blob/master/LICENSE )
1010
11- ## Authors
12-
13- - [ ** Temuri Takalandze** ] ( https://abgeo.dev ) - * Initial work*
14-
1511## Installation
1612
1713You can install this library with [ Composer] ( https://getcomposer.org/ ) :
@@ -49,7 +45,10 @@ and several POPO classes to represent this JSON data:
4945
5046class Department
5147{
52- private string $title;
48+ /**
49+ * @var string
50+ */
51+ private $title;
5352
5453 // Getters and Setters here...
5554}
@@ -62,12 +61,18 @@ class Department
6261
6362class Position
6463{
65- private string $title;
66- private Department $department;
64+ /**
65+ * @var string
66+ */
67+ private $title;
68+
69+ /**
70+ * @var \ABGEO\POPO\Example\Department
71+ */
72+ private $department;
6773
6874 // Getters and Setters here...
6975}
70-
7176```
7277
7378` Person.php `
@@ -77,16 +82,32 @@ class Position
7782
7883class Person
7984{
80- private string $firstName;
81- private string $lastName;
82- private bool $active;
83- private Position $position;
85+ /**
86+ * @var string
87+ */
88+ private $firstName;
89+
90+ /**
91+ * @var string
92+ */
93+ private $lastName;
94+
95+ /**
96+ * @var bool
97+ */
98+ private $active;
99+
100+ /**
101+ * @var \ABGEO\POPO\Example\Position
102+ */
103+ private $position;
84104
85105 // Getters and Setters here...
86106}
87-
88107```
89108
109+ ** Note** : All POPO properties must have full qualified ` @var ` annotation with the correct data type.
110+
90111Now you want to convert this JSON to POPO with relations. This package gives you this ability.
91112
92113Let's create new ` ABGEO\POPO\Composer ` object and read ` example.json ` content:
@@ -135,6 +156,10 @@ Pull requests are welcome. For major changes, please open an issue first to disc
135156
136157Please make sure to update tests as appropriate.
137158
159+ ## Authors
160+
161+ - [ ** Temuri Takalandze** ] ( https://abgeo.dev ) - * Initial work*
162+
138163## License
139164
140165Copyright © 2020 [ Temuri Takalandze] ( https://abgeo.dev ) .
0 commit comments