jeromedia/laravel-github-service
最新稳定版本:v1.2.2
Composer 安装命令:
composer require jeromedia/laravel-github-service
包简介
A service for interacting with GitHub repositories and comparing versions.
README 文档
README
A Laravel package to fetch and compare GitHub repository versions.
Description
This package provides a simple way to:
- Get the current version of a Laravel web application (from Git tags).
- Fetch the latest release tag from a GitHub repository.
- Compare the two versions to check for updates.
Installation
1. Install the package using Composer
composer require jeromedia/laravel-github-service
2. Publish the configuration - Important
php artisan vendor:publish --provider="Jeromedia\LaravelGithubService\GithubServiceProvider" --tag=config
3. The Github Full APi link for fetching the latest release
https://api.github.com/repos/{OWNER}/{REPO}/releases/latest
4. Add to your .env file
#Github Connect GITHUB_API_REPO="" GITHUB_API_OWNER="" GITHUB_API_VERSION="2022-11-28" GITHUB_API_URL="https://api.github.com/repos" GITHUB_API_TOKEN="" GITHUB_API_CACHE_TTL=3600
GitHub Api Token
1. Get a gitHub Fine-Grained Token
https://github.com/settings/personal-access-tokens
2. Repository access
Select only for the repository you want to get the tag version
3. Repository permissions
Select ONLY "Contents", Metadata will automatically selected
Usage
1. Add the following code to your footer
<div class="container mx-auto relative" x-data="{ github: '' }" x-init="fetch('{{route('github.api')}}') .then(response => response.text()) .then(data => { github = data; })">
Somewhere in your footer
<span class="text-stone-400" x-text="github"></span>
2. Add the route to your api routes file or publish the route
Route::get('/github', GithubController::class)->name('github.api');
3. Or publish the route
php artisan vendor:publish --provider="Jeromedia\LaravelGithubService\GithubServiceProvider" --tag=routes
4. Clear the GitHub version cache
php artisan github-service:clear-cache
Development & Contributions
- Author: [Jerome / Jeromedia Team]
- Website: [jeromedia.com]
- Contact: [info@jeromedia.com]
- License: Private (Internal Use)
Notes
- This package requires a GitHub personal access token to fetch repository data.
- Works best with Laravel 9+ and PHP 8+.
统计信息
- 总下载量: 22
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-27