PHP code example of axel-php / axel

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

    

axel-php / axel example snippets


$axel = new Axel\AxelDownload();
$axel->start('http://www.google.com', null, null, function($axel, $status, $success, $error) {
    echo 'File Downloaded';
    print_r($status);
});

$axel = new Axel\AxelDownload();
$axel->startAsync('http://ipv4.download.thinkbroadband.com/1GB.zip', 'test.zip', '~/');

$axel = new Axel\AxelDownload();
$axel->startAsync('http://ipv4.download.thinkbroadband.com/1GB.zip', 'test.zip', '~/', function($axel, $status, $success, $error) {
   echo 'Progress updated';
   print_r($status);
});

$axel = new Axel\AxelDownload();
$axel->addDownloadParameters([
    'address'           => 'http://www.google.com',
    'filename'          => 'test.html',
    'download-path'     => '~/',
    'callback'          => function($axel, $status, $success, $error) {
        echo 'Progress updated';
        print_r($status);
    }
]);
$axel->startAsync();

$status = $axel->updateStatus();

$axel->clearCompleted()

$dm = new Axel\AxelDownloadManager(new AxelDownloadManagerSyncQueue(), 'axel');
$dm->queueDownload('http://www.google.com', 'file1.html');
$dm->queueDownload('http://www.yahoo.com', 'file2.html');
$dm->processQueue();