Go to file
Mathieu 472a6da5a6
Some checks failed
continuous-integration/drone/push Build is failing
readme
2024-01-11 14:23:45 +00:00
.devcontainer readme 2024-01-11 14:23:45 +00:00
src readme 2024-01-11 14:23:45 +00:00
tests addfile 2024-01-11 14:00:23 +00:00
.drone.yml Initial commit 2024-01-11 10:04:42 +00:00
.gitignore Initial commit 2024-01-11 10:04:42 +00:00
composer.json renommage 2024-01-11 10:16:15 +00:00
composer.lock Initial commit 2024-01-11 10:04:42 +00:00
phpcs.xml Initial commit 2024-01-11 10:04:42 +00:00
phpunit.xml Initial commit 2024-01-11 10:04:42 +00:00
README.md readme 2024-01-11 14:23:45 +00:00

multi-downloader-client

Installation

Add repository in composer.json

{
    "repositories": [{
            "type": "composer",
            "url": "https://git.nwb.fr/api/packages/modules-communs-php/composer"
        }
    ]
}

Then run composer require

composer require nwb/multi-downloader-client

Env

The following env variables are used by default

MULTI_DOWNLOADER_API_KEY
MULTI_DOWNLOADER_URL

They can be overriden in the constructor

use Nwb\MultiDownloaderClient\MultiDownloaderClient;

$client = new MultiDownloaderClient([
    'apiKey' => '',
    'url' => '',
])

Usage

Ajouter des fichiers

use Nwb\MultiDownloaderClient\MultiDownloaderClient;
use Nwb\MultiDownloaderClient\FileRequest;

$client = new MultiDownloaderClient();

$client->addFiles([
    new FileRequest('http://example.com/image.png')
    new FileRequest('http://example.com/image1.png')
]);

Get zip as string

$zip = $client->downloadAsString();

Save zip to file (stream)

$client->downloadTo('/tmp/my-zip.zip');

Get html form

$form = $client->htmlForm();