forked from xivapi/xivapi-php
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli_async
More file actions
27 lines (21 loc) · 708 Bytes
/
cli_async
File metadata and controls
27 lines (21 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env php
<?php
// composer auto loader
require __DIR__ . '/vendor/autoload.php';
$option = isset($argv[1]) ? trim($argv[1]) : false;
$arg1 = isset($argv[2]) ? trim($argv[2]) : false;
// setup xivapi
$api = new \XIVAPI\XIVAPI();
$api->environment->key('');
// using concurrent
use GuzzleHttp\Promise;
$promises = [
'item1' => $api->async()->content->Item()->one(1675),
'item2' => $api->async()->content->Item()->one(5),
'item3' => $api->async()->content->Item()->one(2546),
];
$results = Promise\settle($promises)->wait();
$items = $api->unwrap($results);
print_r( $items->item1->Name . PHP_EOL);
print_r( $items->item2->Name . PHP_EOL);
print_r( $items->item3->Name . PHP_EOL);