tournayrelabs/github-sdk-php

PHP SDK for the GitHub REST API, automatically generated from the official OpenAPI specification

Maintainers

Package info

github.com/TournayreLabs/github-sdk-php

pkg:composer/tournayrelabs/github-sdk-php

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-04-29 21:27 UTC

This package is not auto-updated.

Last update: 2026-04-30 00:43:03 UTC


README

PHP SDK for the GitHub REST API, automatically generated from the official OpenAPI specification.

Requirements

  • PHP >= 8.2
  • Composer
  • Node.js >= 20
  • Python 3 (for the auth patch script)

Quick Start

# 1. Install the OpenAPI Generator
make install-openapi-generator

# 2. Fetch the latest GitHub OpenAPI spec and generate the SDK
make fetch-and-generate

# 3. Install PHP dependencies
make install-dependencies

Usage

use TournayreLabs\GitHubSDK\Configuration;
use TournayreLabs\GitHubSDK\Api\ReposApi;

$config = Configuration::getDefaultConfiguration()
    ->setAccessToken('your_github_personal_access_token');

$api = new ReposApi(new GuzzleHttp\Client(), $config);

// Get a repository
$repo = $api->reposGet('owner', 'repo');
echo $repo->getFullName();

Available Make Targets

Target Description
make fetch-and-generate Download spec + apply auth + generate SDK (recommended)
make fetch-openapi Download the latest GitHub OpenAPI spec
make update-spec Alias for fetch-openapi
make generate-sdk Generate SDK from an already-downloaded spec
make install-dependencies Install PHP dependencies
make test Run PHPUnit tests
make test-coverage Run tests with HTML coverage report
make clean Remove generated SDK files
make help Show all available targets

Authentication

The SDK supports the following GitHub authentication methods:

  • Personal Access Token (PAT): $config->setAccessToken('ghp_...')
  • GitHub App JWT: $config->setAccessToken('your_jwt_token')
  • OAuth2 token: $config->setAccessToken('gho_...')

Regenerating the SDK

The SDK is generated from the official GitHub OpenAPI specification. To regenerate with the latest API changes:

make fetch-and-generate

OpenAPI Source

The GitHub REST API OpenAPI description is maintained at: github/rest-api-description

License

MIT