daVAhome / github-client
dev-master
2018-01-26 09:13 UTC
Requires
- php: >=5.4
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-09-29 00:57:51 UTC
README
提供使用PHP与GitHub进行通信的功能。
此功能的可能用法是实现基于GitHub API的自动更新功能(用于私有仓库)
安装
php composer.phar require davahome/github-php-api
使用
use DavaHome\GithubApi\AssetFileDownloader; $assetFileDownloader = new AssetFileDownloader('davahome', 'github-api', '<TOKEN>'); // Display some release information (optional) $releaseInformation = $assetFileDownloader->getReleaseInformation(); $date = new \DateTime($releaseInformation['published_at']); echo 'Version: ', $releaseInformation['tag_name'], PHP_EOL; echo 'Published: ', $date->format('Y-m-d H:i:s'), PHP_EOL; // Download the asset $fileContent = $assetFileDownloader->downloadAsset('file.phar'); file_put_contents('file.phar', $fileContent);