ssionn/github-forge-laravel is a Laravel package for a github rest api client for laravel.
It currently has 0 GitHub stars and 130 downloads on Packagist (latest version v1.0.7).
Install it with composer require ssionn/github-forge-laravel.
Discover more Laravel packages by ssionn
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package for interacting with the GitHub REST API. Facades are the preferred usage pattern.
composer require ssionn/github-forge-laravelSsionn\GithubForgeLaravel\GithubForgeServiceProvider::class,php artisan vendor:publish \ --provider="Ssionn\GithubForgeLaravel\GithubForgeServiceProvider" \ --tag=configGITHUB_FORGE_TOKEN=your_github_token_hereThe package’s config/github-forge.php reads this by default.
config/github-forge.php
return [
'token' => env('GITHUB_FORGE_TOKEN', ''),
];
Publish and override as needed.
withToken().Alias in config/app.php (if you’re not using auto-discovery):
'GithubForge' => Ssionn\GithubForgeLaravel\Facades\GithubForge::class,Usage examples (facade-first)
use Ssionn\GithubForgeLaravel\Facades\GithubForge;
// Resolve the per-request token (user token or default)
$token = auth()->user()?->github_token ?? config('github-forge.token');
// Per-request client, then call
$repos = GithubForge::withToken($token)->getRepositories('octocat', ['per_page' => 50]);
Simple usage with the default app token:
$user = GithubForge::getUser('octocat');
Other methods (examples)
$repo = GithubForge::getRepository('laravel', 'framework');
$contributors = GithubForge::getContributors('laravel', 'framework');
$commits = GithubForge::getCommitsFromRepository('laravel', 'framework', [ 'sha' => 'main', 'per_page' => 20, ]);
$issues = GithubForge::getIssues('laravel', 'framework', [ 'state' => 'closed', 'per_page' => 30, ]);
$pulls = GithubForge::getPullRequests('laravel', 'framework', [ 'state' => 'all', 'per_page' => 10, ]);
If you store GitHub tokens in the database, use encrypted storage and a separate hash for uniqueness.
What to add in migrations
Example migration (to adapt to your user/model table; adjust table name as needed, e.g., users, github_accounts, etc.):
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddGithubTokenColumnsToUsersTable extends Migration
{
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
// Store the secret token encrypted at rest
$table->text('github_secret_token')->nullable();
// Hash for uniqueness (e.g., to prevent duplicates)
$table->string('github_token_hash')->nullable()->unique();
});
}
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['github_secret_token', 'github_token_hash']);
});
}
}
Model changes (to apply encryption and hash)
class User extends Authenticatable
{
// Encrypt the github_secret_token in storage
protected $casts = [
'github_secret_token' => 'encrypted',
];
// Optional: hide sensitive fields from arrays/json
protected $hidden = [
'github_secret_token',
'github_token_hash',
];
// Ensure a hash is stored whenever the secret token is set
public function setGithubSecretTokenAttribute(?string $value)
{
// Hash for uniqueness
$this->attributes['github_token_hash'] = $value ? hash('sha256', $value) : null;
// Store the encrypted token (the cast handles encryption)
$this->attributes['github_secret_token'] = $value;
}
}
Notes:
Usage reminder
withToken(string $token).