X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fseekat;a=blobdiff_plain;f=README.md;h=cdca98036a595b9799788e324deba9eca24f0605;hp=6d092623979deb680caf4ad8e0c77b78881098b3;hb=8f7bfbf9cb5340c1fc8a6e3d34724a4fe09bf66c;hpb=8ef054b51c681e7822133b38f7c5ed9dd2a0f29c diff --git a/README.md b/README.md index 6d09262..cdca980 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ # seekat +[![Build Status](https://travis-ci.org/m6w6/seekat.svg)](https://travis-ci.org/m6w6/seekat) + Fluent Github API access with PHP-7 and [ext-http](https://github.com/m6w6/ext-http). +Simple example: + ```php repos->m6w6->seekat->readme->as("html")->then(function($readme) { +$api = new API; + +$api->repos->m6w6->seekat->readme->as("html")->then(function($readme) { echo $readme; }, function($error) { echo $error; @@ -16,6 +22,61 @@ use seekat\API; $api->send(); ``` +Full example: + +```php +configure([ + "max_host_connections" => 10, + "max_total_connections" => 50, +]); + +$log = new Monolog\Logger("seekat"); +$log->pushHandler(new Monolog\Handler\StreamHandler(STDERR, Monolog\Logger::WARNING)); + +$api = new API([ + "Authorization" => "token ".getenv("GITHUB_TOKEN") +], null, $cli, $log); + +$api(function($api) { + $repos = yield $api->users->m6w6->repos([ + "visibility" => "public", + "affiliation" => "owner" + ]); + while ($repos) { + $next = next($repos); + + $batch = []; + foreach ($repos as $repo) { + $batch[] = $repo->hooks(); + } + foreach (yield $batch as $key => $hooks) { + if (!count($hooks)) { + continue; + } + printf("%s:\n", $repos->{$key}->name); + foreach ($hooks as $hook) { + if ($hook->name == "web") { + printf("\t%s\n", $hook->config->url); + } else { + printf("\t%s\n", $hook->name); + } + } + } + + $repos = yield $next; + } +}); +``` + + > ***Note:*** WIP @@ -28,7 +89,7 @@ $api->send(); ## ChangeLog A comprehensive list of changes can be obtained from the -[releases overview](./releases). +[releases overview](https://github.com/m6w6/seekat/releases). ## License