PHPackages                             conduit-ui/github-connector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. conduit-ui/github-connector

Abandoned → [https://www.github.com/conduit-ui/connector](/?search=https%3A%2F%2Fwww.github.com%2Fconduit-ui%2Fconnector)Library[API Development](/categories/api)

conduit-ui/github-connector
===========================

Core GitHub API connector with authentication

v1.0.0(10mo ago)0750[1 issues](https://github.com/conduit-io/github-connector/issues)[1 PRs](https://github.com/conduit-io/github-connector/pulls)MITPHPPHP ^8.2|^8.3|^8.4CI failing

Since Jun 27Pushed 3mo agoCompare

[ Source](https://github.com/conduit-io/github-connector)[ Packagist](https://packagist.org/packages/conduit-ui/github-connector)[ Docs](https://github.com/conduit-ui/github-connector)[ RSS](/packages/conduit-ui-github-connector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (4)Used By (0)

Connector - GitHub API Without the Guesswork
============================================

[](#connector---github-api-without-the-guesswork)

[![Latest Version](https://camo.githubusercontent.com/a7a9356ce1ad0352992415b2c55b24b725ca064175cca33c533fc6fd6f979f0d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6e647569742d75692f636f6e6e6563746f722e737667)](https://packagist.org/packages/conduit-ui/connector)[![Total Downloads](https://camo.githubusercontent.com/9454878edb4506d4d66e8b5bdf6b2c1f9c866f5969cfb29cfaa44570c7800990/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6e647569742d75692f636f6e6e6563746f722e737667)](https://packagist.org/packages/conduit-ui/connector)[![PHP Version](https://camo.githubusercontent.com/7e613b0d86227df0de91ce36b759c415e974cff81d72bb186c99a39aa204dded/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f6e647569742d75692f636f6e6e6563746f722e737667)](https://packagist.org/packages/conduit-ui/connector)[![Tests](https://github.com/conduit-ui/connector/actions/workflows/gate.yml/badge.svg)](https://github.com/conduit-ui/connector/actions/workflows/gate.yml)[![License](https://camo.githubusercontent.com/bc4f87051325718b6822c27608b5e718999e39f4a64a784b1a26e4fb807df5a4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f6e647569742d75692f636f6e6e6563746f722e737667)](LICENSE)

Stop wrestling with GitHub API authentication and error handling. Start with a clean HTTP transport layer that maps GitHub's API responses to typed exceptions automatically.

**Perfect for:** Building GitHub integrations, creating developer tools, automating repository workflows

Installation
------------

[](#installation)

```
composer require conduit-ui/connector
```

Quick Start
-----------

[](#quick-start)

```
use ConduitUi\GitHubConnector\Connector;

$connector = new Connector('ghp_your_token_here');

// Make requests - exceptions are typed automatically
try {
    $repos = $connector->send($getUserReposRequest);
    $newRepo = $connector->send($createRepoRequest);
} catch (GitHubRateLimitException $e) {
    // Handle rate limits with context
} catch (GitHubAuthException $e) {
    // Handle auth failures
}
```

Features
--------

[](#features)

- **Token authentication** - Pass your GitHub token, done
- **Automatic exception mapping** - 401s become `GitHubAuthException`, 403s become `GitHubForbiddenException`, 404s become `GitHubResourceNotFoundException`
- **Rate limit awareness** - Headers exposed, limits tracked
- **Built on Saloon** - Full power of Saloon's HTTP client underneath
- **GitHub API v3 compatibility** - API version headers set correctly
- **Zero opinions on requests** - Bring your own Request objects or use with higher-level SDKs

Why This Exists
---------------

[](#why-this-exists)

GitHub's API returns generic HTTP errors. Your application needs domain-specific exceptions. This package bridges that gap without forcing you into a full SDK.

The connector is the foundation - it handles authentication and error translation. Build your own request layer on top, or use it with conduit-ui's higher-level packages.

Usage
-----

[](#usage)

### Basic Authentication

[](#basic-authentication)

```
$connector = new Connector('ghp_your_token_here');
```

### Using with Saloon Requests

[](#using-with-saloon-requests)

```
use Saloon\Http\Request;
use Saloon\Enums\Method;

class GetUserRepos extends Request
{
    protected Method $method = Method::GET;

    public function resolveEndpoint(): string
    {
        return '/user/repos';
    }
}

$response = $connector->send(new GetUserRepos());
$repos = $response->json();
```

### Exception Handling

[](#exception-handling)

All GitHub HTTP errors are mapped to typed exceptions:

```
use ConduitUi\GitHubConnector\Exceptions\{
    GitHubAuthException,           // 401 Unauthorized
    GitHubForbiddenException,      // 403 Forbidden
    GitHubResourceNotFoundException, // 404 Not Found
    GitHubValidationException,     // 422 Validation Failed
    GitHubRateLimitException,      // 429 Rate Limited
    GitHubServerException          // 500+ Server Errors
};

try {
    $response = $connector->send($request);
} catch (GitHubRateLimitException $e) {
    // Check rate limit headers
    $resetAt = $e->getResponse()->header('X-RateLimit-Reset');
    sleep($resetAt - time());
    // Retry...
} catch (GitHubResourceNotFoundException $e) {
    // Handle missing resource
} catch (GitHubException $e) {
    // Catch-all for any GitHub API error
}
```

### Rate Limit Headers

[](#rate-limit-headers)

GitHub's rate limit headers are automatically included in responses:

```
$response = $connector->send($request);

$remaining = $response->header('X-RateLimit-Remaining');
$resetAt = $response->header('X-RateLimit-Reset');
```

Repository Context
------------------

[](#repository-context)

The connector maintains a static repository context that ecosystem packages can inherit. Set once, use everywhere.

### Setting Context

[](#setting-context)

```
use ConduitUi\GitHubConnector\Connector;

// Set the repo context once
Connector::forRepo('owner/repo');

// All ecosystem packages now inherit this context
Issue::all();           // No repo arg needed
PullRequests::open();   // No repo arg needed
Commit::latest();       // No repo arg needed
```

### Accessing Context

[](#accessing-context)

```
// Get the full repo string (nullable)
Connector::repo();       // 'owner/repo' or null

// Get the full repo string (throws if not set)
Connector::requireRepo(); // 'owner/repo' or throws NoRepoContextException

// Get individual parts
Connector::owner();      // 'owner'
Connector::repoName();   // 'repo'
```

### Switching Context

[](#switching-context)

```
// Work on first repo
Connector::forRepo('acme/api');
Issue::all(); // Issues from acme/api

// Switch to different repo
Connector::forRepo('acme/web');
Issue::all(); // Now issues from acme/web

// Clear context entirely
Connector::clearRepo();
Connector::repo(); // null
```

### Error Handling

[](#error-handling)

```
use ConduitUi\GitHubConnector\Exceptions\NoRepoContextException;

try {
    // Throws if no context set
    $owner = Connector::owner();
} catch (NoRepoContextException $e) {
    // "No repository context set. Call Connector::forRepo() first."
}

// Or check first
if (Connector::repo() !== null) {
    $owner = Connector::owner();
}
```

### Using in Ecosystem Packages

[](#using-in-ecosystem-packages)

Packages in the conduit-ui ecosystem can delegate to the connector:

```
// In your package (e.g., conduit-ui/issue)
class Issue
{
    public static function forRepo(string $repository): void
    {
        Connector::forRepo($repository);
    }

    public static function all(): Collection
    {
        $owner = Connector::owner();
        $repo = Connector::repoName();

        // Fetch issues using inherited context...
    }
}
```

This creates a unified experience where any package can set or use the context:

```
// User can set context via any package
Issue::forRepo('owner/repo');

// Or directly on connector
Connector::forRepo('owner/repo');

// Either way, all packages inherit it
PullRequests::open()->get();
Commit::since(now()->subWeek());
```

Related Packages
----------------

[](#related-packages)

The conduit-ui ecosystem builds on this connector:

- **[conduit-ui/issue](https://github.com/conduit-ui/issue)** - GitHub issue management
- **[conduit-ui/pr](https://github.com/conduit-ui/pr)** - Pull request operations
- **[conduit-ui/repo](https://github.com/conduit-ui/repo)** - Repository operations
- **[conduit-ui/commit](https://github.com/conduit-ui/commit)** - Commit management
- **[conduit-ui/action](https://github.com/conduit-ui/action)** - GitHub Actions operations
- **[conduit-ui/know](https://github.com/conduit-ui/know)** - Domain knowledge for AI agents

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Saloon HTTP client 3.10+

Testing
-------

[](#testing)

```
composer test
```

Support
-------

[](#support)

**Enterprise support available** - Need SLA guarantees, custom integrations, or priority bug fixes? Email

**Community** - Open an issue on [GitHub](https://github.com/conduit-ui/connector/issues) or contribute a PR.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance69

Regular maintenance activity

Popularity14

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

323d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a6bb27de88a541a632427686306c8fc56366d72582f6a3316d20500efe7971f3?d=identicon)[conduit-ui](/maintainers/conduit-ui)

---

Top Contributors

[![jordanpartridge](https://avatars.githubusercontent.com/u/9040417?v=4)](https://github.com/jordanpartridge "jordanpartridge (20 commits)")

---

Tags

apigithubconnectorconduit-ui

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/conduit-ui-github-connector/health.svg)

```
[![Health](https://phpackages.com/badges/conduit-ui-github-connector/health.svg)](https://phpackages.com/packages/conduit-ui-github-connector)
```

###  Alternatives

[phpsa/laravel-postman

Export laravel API routes to postman

1014.7k](/packages/phpsa-laravel-postman)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
