davahome / github-php-api
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/davahome/github-php-api
Requires
- php: >=5.4
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2021-03-28 17:53:14 UTC
README
Provides functionality for communication with the github using php.
A possible usage of this is the implementation a github api based self-update functionality (for private repositories)
Installation
php composer.phar require davahome/github-php-api
Usage
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);