Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Github Api Laravel Package

knplabs/github-api

Lightweight, well-tested PHP wrapper for GitHub APIs v3 (REST) and v4 (GraphQL). PSR-17/PSR-18 compatible via HTTPlug, with easy setup using Guzzle, Symfony HttpClient, or other PSR clients. Supports framework integrations (Laravel via graham-campbell/github).

View on GitHub
Deep Wiki
Context7

GraphQL API

Back to the navigation

Wraps GitHub v4 API (GraphQL API).

Execute a query

$rateLimits = $client->api('graphql')->execute($query);

Authentication

To use GitHub v4 API (GraphQL API) requests must authenticate.

$client->authenticate($token, null, Github\AuthMethod::ACCESS_TOKEN);

$result = $client->api('graphql')->execute($query);

Use different Accept Headers

You can preview upcoming features and changes to the GitHub GraphQL schema before they are added to the GitHub GraphQL API. To access a schema preview, you'll need to provide a custom media type in the Accept header for your requests. Feature documentation for each preview specifies which custom media type to provide. More info about Schema Previews.

To use GitHub v4 API (GraphQL API) with different Accept header you can pass third argument to execute method.

$result = $client->api('graphql')->execute($query, [], 'application/vnd.github.starfox-preview+json')

default accept header is application/vnd.github.v4+json

Use variables

Variables allow specifying of requested data without dynamical change of a query on a client side.

$query = <<<'QUERY'
query showOrganizationInfo (
  $organizationLogin: String!
) {
  organization(login: $organizationLogin) {
    name
    url
  }
}
QUERY;
$variables = [
    'organizationLogin' => 'KnpLabs'
];

$client->authenticate('<your-token>', null, Github\AuthMethod::ACCESS_TOKEN);

$orgInfo = $client->api('graphql')->execute($query, $variables);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation