Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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);
```