davahome / self-update
Simple self update library using github api
1.2
2021-03-28 17:39 UTC
Requires
- php: >=5.4
- ext-json: *
This package is auto-updated.
Last update: 2025-03-29 00:19:49 UTC
README
Provides functionality for implementing a github api based self-update functionality (for private repositories)
Installation
php composer.phar require davahome/self-update
Usage
use DavaHome\SelfUpdate\AssetFileDownloader; $assetFileDownloader = new AssetFileDownloader('davahome', 'self-update', '<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);