update to PHP-8.1
[m6w6/seekat] / examples / cli.php
1 #!/usr/bin/env php
2 <?php
3
4 require_once __DIR__."/../vendor/autoload.php";
5
6 $api = new seekat\API(seekat\API\Future\react(), [
7 "Authorization" => "token ".getenv("GITHUB_TOKEN")
8 ]);
9 array_shift($argv);
10
11 ($self = function($api) use(&$self) {
12 global $argv;
13
14 while (null !== ($arg = array_shift($argv))) {
15 if ("." === $arg) {
16 $api->then($self);
17 return;
18 }
19 $api = $api->$arg;
20 }
21
22 echo $api, "\n";
23 })($api);
24
25 $api->send();