PHP code example of ector / release-downloader

1. Go to this page and download the library: Download ector/release-downloader 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/ */

    

ector / release-downloader example snippets


 
use \Ector\ReleaseDownloader\Downloader;

$autoload = dirname(__FILE__) . "/vendor/autoload.php";
if (file_exists($autoload)) ; // or null to download the latest version

$downloader = new Downloader($GitHubRepoOwner, $GitHubRepoName, $ReleaseVersion, $GitHubAccessToken);

$downloader->getLatestTagName();

$downloader->addAssetToDownload();

$downloader->addSourceCodeToDownload();

$downloader->addAssetToDownload("asset_name.zip");

$downloader->download("/destination/path/");

$downloader->extract(); // extract in the same directory where assets are downloaded
// or 
$downloader->extract("/destination/path/");

$downloader->extract("/destination/path/", true);

$downloader->delete();

$downloader->extractAndDelete(); // extract in the same directory where assets are downloaded
// or 
$downloader->extractAndDelete("/destination/path/", true);