2017 © Pedro Peláez
 

library seekat

seekat wraps github api in php

image

m6w6/seekat

seekat wraps github api in php

  • Friday, January 13, 2017
  • by m6w6
  • Repository
  • 0 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

seekat

Build Status, (*1)

Fluent Github API access with ext-http., (*2)

Support for the following promise providers built in: * ReactPHP * AmPHP, (*3)

Supports plugging into your favourite event loop through http\Client's custom event loop interface., (*4)

Simple example:, (*5)

<?php

use seekat\API;

$api = new API(API\Future\react());

$api->repos->m6w6->seekat->readme->as("html")->then(function($readme) {
    echo $readme;
}, function($error) {
    echo $error;
});

$api->send();

Full example:, (*6)

<?php

require_once __DIR__."/../vendor/autoload.php";

use seekat\API;
use function seekat\API\Links\next;

$cli = new http\Client("curl", "seekat");
$cli->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(API\Future\react(), [
    "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;
    }
});

Installing

Composer

composer require m6w6/seekat

ChangeLog

A comprehensive list of changes can be obtained from the releases overview., (*7)

License

seekat is licensed under the 2-Clause-BSD license, which can be found in the accompanying LICENSE file., (*8)

Contributing

All forms of contribution are welcome! Please see the bundled CONTRIBUTING note for the general principles followed., (*9)

The list of past and current contributors is maintained in THANKS., (*10)

The Versions

13/01 2017

dev-master

9999999-dev

seekat wraps github api in php

  Sources   Download

BSD-2-Clause

The Requires

 

The Development Requires

by Michael Wallner

api php github api seekat