PHP code example of davahome / self-update

1. Go to this page and download the library: Download davahome/self-update library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

davahome / self-update example snippets


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);
bash
php composer.phar