Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davahome/self-update
A php library for using the github api to implement a self-update functionality
https://github.com/davahome/self-update
composer github phar php update
Last synced: about 2 months ago
JSON representation
A php library for using the github api to implement a self-update functionality
- Host: GitHub
- URL: https://github.com/davahome/self-update
- Owner: davahome
- License: gpl-3.0
- Created: 2017-07-21T09:31:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-03-28T17:48:52.000Z (almost 4 years ago)
- Last Synced: 2024-10-20T11:50:53.971Z (3 months ago)
- Topics: composer, github, phar, php, update
- Language: PHP
- Homepage:
- Size: 18.6 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# self-update
Provides functionality for implementing a github api based self-update functionality (for private repositories)
# Installation
```bash
php composer.phar require davahome/self-update
```# Usage
```php
use DavaHome\SelfUpdate\AssetFileDownloader;$assetFileDownloader = new AssetFileDownloader('davahome', 'self-update', '');
// 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);
```