@@ -1,10 +1,8 @@
|
||||
# multi-downloader-client
|
||||
|
||||
## Utilisation
|
||||
|
||||
## Installation
|
||||
### Composer
|
||||
Ajouter les modules communs dans composer.json
|
||||
|
||||
Add repository in composer.json
|
||||
```json
|
||||
{
|
||||
"repositories": [{
|
||||
@@ -14,7 +12,53 @@ Ajouter les modules communs dans composer.json
|
||||
]
|
||||
}
|
||||
```
|
||||
Lancer la commande
|
||||
Then run composer require
|
||||
```bash
|
||||
composer require nwb/multi-downloader-client
|
||||
```
|
||||
|
||||
## Env
|
||||
The following env variables are used by default
|
||||
```dotenv
|
||||
MULTI_DOWNLOADER_API_KEY
|
||||
MULTI_DOWNLOADER_URL
|
||||
```
|
||||
They can be overriden in the constructor
|
||||
```php
|
||||
use Nwb\MultiDownloaderClient\MultiDownloaderClient;
|
||||
|
||||
$client = new MultiDownloaderClient([
|
||||
'apiKey' => '',
|
||||
'url' => '',
|
||||
])
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Ajouter des fichiers
|
||||
```php
|
||||
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
|
||||
```php
|
||||
$zip = $client->downloadAsString();
|
||||
```
|
||||
|
||||
Save zip to file (stream)
|
||||
```php
|
||||
$client->downloadTo('/tmp/my-zip.zip');
|
||||
```
|
||||
|
||||
Get html form
|
||||
```php
|
||||
$form = $client->htmlForm();
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user