Skip to content

Commit 1d77cb5

Browse files
committed
update readme
1 parent f108d51 commit 1d77cb5

File tree

3 files changed

+119
-10
lines changed

3 files changed

+119
-10
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ Following API examples are shown based on the sample JSON data given [here](exam
135135
* [find](#findpath)
136136
* [at](#atpath)
137137
* [from](#frompath)
138+
* [select](#select)
139+
* [except](#except)
138140
* [then](#then)
139141
* [collect](#collect)
140142
* [json](#json)
@@ -173,8 +175,8 @@ Following API examples are shown based on the sample JSON data given [here](exam
173175
* [transform](#transform)
174176
* [each](#each)
175177
* [pipe](#pipe)
176-
* [macro](#macro)
177178
* [chunk](#chunk)
179+
* [macro](#macro)
178180

179181
### `fetch()`
180182

examples/data1.json

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,102 @@
191191
"id": 1055396221
192192
}
193193
]
194+
},
195+
{
196+
"id": 42844287,
197+
"number": "2",
198+
"issued_at": "2018-01-15",
199+
"created_at": "2018-01-15T15:29:22-05:00",
200+
"due_at": "2018-01-31",
201+
"tax_rate": 0,
202+
"secondary_tax_rate": 0,
203+
"updated_at": "2018-03-30T15:20:57-04:00",
204+
"subject": null,
205+
"purchase_order": null,
206+
"type": "MatterBill",
207+
"memo": null,
208+
"start_at": "2018-01-15",
209+
"end_at": "2018-01-15",
210+
"balance": 740,
211+
"config": {
212+
"text": {
213+
"client_address_custom": "566 Olympic Way"
214+
},
215+
"show": {
216+
"client_address_id": 80750975
217+
},
218+
"css": []
219+
},
220+
"state": "awaiting_payment",
221+
"kind": "revenue_kind",
222+
"total": 1190,
223+
"paid": 450,
224+
"paid_at": "2018-03-30",
225+
"pending": 0,
226+
"due": 740,
227+
"can_update": false,
228+
"credits_issued": 0,
229+
"client_addresses": [
230+
{
231+
"id": 80750975
232+
}
233+
],
234+
"shared": false,
235+
"sub_total": 1190,
236+
"tax_sum": 0,
237+
"secondary_tax_sum": 0,
238+
"discount": {
239+
"rate": 0,
240+
"type": "percentage",
241+
"note": null,
242+
"early_payment_rate": 0,
243+
"early_payment_period": 0
244+
},
245+
"interest": {
246+
"rate": 0,
247+
"type": 0,
248+
"period": 0,
249+
"balance": 0,
250+
"total": 0
251+
},
252+
"original_bill": null,
253+
"balances": [
254+
{
255+
"id": 1055396221,
256+
"amount": 740,
257+
"type": "Matter",
258+
"interest_amount": 0,
259+
"due": 740
260+
}
261+
],
262+
"matter_totals": [
263+
{
264+
"amount": 1190
265+
}
266+
],
267+
"currency": {
268+
"id": 1,
269+
"code": "USD",
270+
"sign": "$"
271+
},
272+
"user": {
273+
"id": 345101090,
274+
"initials": "JT",
275+
"first_name": "James",
276+
"last_name": "Turner",
277+
"name": "James Turner",
278+
"phone_number": "",
279+
"rate": 225,
280+
"subscription_type": "Attorney"
281+
},
282+
"client": {
283+
"id": 950888733
284+
},
285+
"matters": [
286+
{
287+
"id": 1055396221
288+
}
289+
]
194290
}
195291
]
196292
}

examples/index.php

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,23 @@
1717

1818
$jq = new Jsonq('data1.json');
1919

20-
$result = $jq->from('data')
21-
->pipe(function($j) {
22-
return $j->transform(function($val) {
23-
$val['user_id'] = $val['user']['id'];
24-
return $val;
25-
});
26-
})->get();
27-
28-
dump($result);
20+
try {
21+
$result = $jq->from('data')
22+
->pipe(function($j) {
23+
return $j->transform(function($val) {
24+
$val['user_id'] = $val['user']['id'];
25+
$val['issued_at'] = date('Y, M d', strtotime($val['issued_at']));
26+
$val['created_at'] = date('Y, M d h:i:s', strtotime($val['created_at']));
27+
// $val['balance'] = $val['balance'] * 80;
28+
return $val;
29+
});
30+
})
31+
//->select('user_id', 'number', 'balance')
32+
->implode('balance', ' ');
33+
34+
dump($result);
35+
} catch (\Nahid\JsonQ\Exceptions\ConditionNotAllowedException $e) {
36+
37+
} catch (\Nahid\JsonQ\Exceptions\NullValueException $e) {
38+
39+
}

0 commit comments

Comments
 (0)