PHPackages                             ycoya/guzzlehttp-resume - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. ycoya/guzzlehttp-resume

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ycoya/guzzlehttp-resume
=======================

To download by range a resource and be able to resume the download if it has been interrupted.

22PHP

Since Sep 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ycoya/guzzlehttp-resume)[ Packagist](https://packagist.org/packages/ycoya/guzzlehttp-resume)[ RSS](/packages/ycoya-guzzlehttp-resume/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

About Guzzlehttp-resume
-----------------------

[](#about-guzzlehttp-resume)

Guzzlehttp-resume is a wrapper for guzzlehttp to allow downloads by chunks. If a download is interrupted it can be resume later, without the need to start the download again from zero. This is possible only if the server support partial requests.

It has two classes **ClientResume** and **ClientHttpResume**. The difference of these two classes is that **ClientResume** has methods to set actions and settings, while ClientHttpResume is a wrapper of the first that allows set options similar to guzzlehttp.

This doesn't affect the guzzlehttp main functionality, if you are already using it in your code, no drastical changes should be made, just replace the guzzlehttp with one of these classes and you should get the same results. The changes that need to be made are the new options and a new method to download by chunks. See in examples folder for a better understanding.

Here are examples using these classes.

Using **ClientResume**

```
 false,
];
echo "starting download";
$client->downloadChunkSize = 10*1024*1024;
$client->setDebug(true);
$client->setfilePath("descarga/video.mp4");
$client->resume('GET', $url, $options);
```

Using **ClientHttpResume**

```
 false,
   'clientResume' => [
      'chunkSize'=> 10 * 1024 *1024,
      'filePath' => "descarga/video.mp4",
      'debug'   => true
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

Installation
------------

[](#installation)

```
  composer require ycoya/guzzlehttp-resume
```

Requirements
------------

[](#requirements)

php 8.0+

Options
-------

[](#options)

These are all the options that can be set

```
 'http://httpbin.org']);

$client = new ClientResume();
$client->setClient($guzzleClient);
$client->downloadChunkSize = 10*1024*1024;
$client->setfilePath("descarga/video.mp4");
$client->setPartialExtension("partFile");
$client->setHandler(GuzzleHttp\HandlerStack::create());
$client->setDebug(true);
$client->setDebugVerbose(true);
$client->resume('GET', 'video');
```

```
 'http://httpbin.org']);
$options = [
    'handler'   => GuzzleHttp\HandlerStack::create(),
   'clientResume' => [
      'client'   => $guzzleClient,
      'chunkSize'=> 10 * 1024 *1024,
      'filePath' => "descarga/video.mp4",
      'partialExt' => "partFile",
      'debug'   => true,
      'debugVerbose'   => true,
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', 'video', $options);
```

Guzzle options can be set in the array too. All options set outside *clientResume* key are for guzzle options.

```
 'http://httpbin.org',
   'handler'   => GuzzleHttp\HandlerStack::create(),
   'clientResume' => [
      'chunkSize'=> 10 * 1024 *1024,
      'filePath' => "descarga/video.mp4",
      'partialExt' => "partFile",
      'debug'   => true
      ]
   ];
   $client = new ClientHttpResume();
   $client->downloadResume('GET', 'video', $options);
```

When using **ClientHttpResume** class, you have to set a key named `clientResume` and inside this you set all the options needed.

\#Client option

In fact, it is not necessary to set a GuzzleClient object. When **ClientHttpResume** or **ClientResume** is created, an object for GuzzleClient is created too, so if you need to pass options you set it outside of `clientResume` key option. Let assume we need to set base uri option to guzzleClient. It can be set as the example above. And the handler too.

```
 'http://httpbin.org',
   'clientResume' => [
          ...
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', 'video', $options);
```

But let say, that you already have a GuzzleClient object and you can't replace it by **ClientHttpResume**. For this case you can set the option `client` and passed it to **ClientHttpResume**, it will use all the settings made in GuzzleClient object when resume or starting the download.

```
 'http://httpbin.org']);
$options = [
   'clientResume' => [
          'client' => $guzzleClient,
           ...
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', 'video', $options);
```

\#ChunkSize option

It not necessary to set this value, because **ClientHttpResume** or **ClientResume** uses a default value inside, but if you need to customize it, you have to set this value to bytes. In the next example we set a chunkSize of 10 MB.

```
 [
           'chunkSize' => 10 * 1024*1024 // in bytes.
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

\#filePath option

This is optional too. If not filepath is provided, the application will try to build a filename by its url. filePath is a string and it should contain filename.

```
 [
           'filePath' => "C:/downloads/video.mp4"
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

\#partialExt option

This is the extension used in the temporary download file, before complete download. By default the application used *part* as extension. Ex: *video.mp4.part*

```
 [
           'partialExt' => "filePart"
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

\#handler option

This option is to set a GuzzleHttp\\HandlerStack if needed. To know how to build it, see the docs from [guzzlehttp/guzzle](https://docs.guzzlephp.org/en/stable/handlers-and-middleware.html). To pass this option is outside from ClientResume key. It´s set as a guzzle option. The fact we state here is because this handler is modified internally to add own middlewares to be able to download by chunks.

```
 $handler
           'clientResume' => [
               ...
            ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

\#debug option

The debug option enables the action of creating logs with a path debug/log-{timestamp}.log. In addition to this file is also dumped guzzle stats inside a folder named stats.

```
 [
           'debug' => true
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

\#debugVerbose option

The debugVerbose option enables to dump the whole body of the response sent by the server in log file. This option enable debug internally too.

```
 [
           'debugVerbose' => true
      ]
   ];
$client = new ClientHttpResume();
$client->downloadResume('GET', $url, $options);
```

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/821fe20eaaf8256429d57ae0a6afbf236a5e48578edfc74a2ff1e4cd779e23fd?d=identicon)[ycoya](/maintainers/ycoya)

---

Top Contributors

[![ycoya](https://avatars.githubusercontent.com/u/5576242?v=4)](https://github.com/ycoya "ycoya (15 commits)")

---

Tags

chunksdownloadguzzlehttppartialpartial-requestphpresumable

### Embed Badge

![Health badge](/badges/ycoya-guzzlehttp-resume/health.svg)

```
[![Health](https://phpackages.com/badges/ycoya-guzzlehttp-resume/health.svg)](https://phpackages.com/packages/ycoya-guzzlehttp-resume)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M316](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
