PHPackages                             shemgp/http-send-file - 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. shemgp/http-send-file

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

shemgp/http-send-file
=====================

Sends a file to a client, with support for (multiple) range requests. It is also able to throttle the download.

v2.0.4(7y ago)1208MITPHP

Since Mar 2Pushed 7y ago1 watchersCompare

[ Source](https://github.com/shemgp/http-send-file)[ Packagist](https://packagist.org/packages/shemgp/http-send-file)[ Docs](http://github.com/diversen/http-send-file)[ RSS](/packages/shemgp-http-send-file/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (17)Used By (0)

HTTP send file
==============

[](#http-send-file)

Sends a file with support for (multiple) range requests. It is able to throttle the download. It is quite small and simple.

This class resembles the php http\_send\_file from PHP pecl

See:

Install

With composer add to your "require" section:

```
composer require shemgp/http-send-file

```

Usage example:

```
use diversen\sendfile;
$s = new sendfile();

// if you don't set type - we will try to guess it
$s->contentType('application/epub+zip');

// if you don't set disposition (file name user agent will see)
// we will make a file name from file
$s->contentDisposition('test.epub');

// chunks of 40960 bytes per 0.1 secs
// if you don't set this then the values below are the defaults
// approx 409600 bytes per sec
$s->throttle(0.1, 40960);

// file
$file = '/some/dir/test.epub';

// send the file
try {
    $s->send($file);
} catch (\Exception $e) {
    echo $e->getMessage();
}
```

So you could just do like this:

```
use diversen\sendfile;
$s = new sendfile();

// file
$file = '/some/dir/test.epub';

// send the file
try {
    $s->send($file);
} catch (\Exception $e) {
    echo $e->getMessage();
}

// but check the headers if it is not
// working as expected as the guessing
// of content-type does not always work
// correctly.
```

Without sending content-disposition header:

```
// without sending content-disposition header
// 2. param = false
try {
    $s->send($file, false);
} catch (\Exception $e) {
    echo $e->getMessage();
}
```

Send file as inline:

```
// Send as inline
// 3. param = false
try {
    $s->send($file, true, false);
} catch (\Exception $e) {
    echo $e->getMessage();
}
```

Credits
=======

[](#credits)

Much of the code is taken (and rewritten) from here:

The process is nicely explained here:

MIT © [Dennis Iversen](https://github.com/diversen), [Shem Pasamba](https://github.com/shemgp)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 80.4% 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.

###  Release Activity

Cadence

Every ~84 days

Recently: every ~63 days

Total

15

Last Release

2911d ago

Major Versions

v1.0.91 → v2.0.02017-09-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/699ad758d563e3f5939fe22bb58184470ac9a5dfd83684639a6ed0b20c1a7331?d=identicon)[shemgp](/maintainers/shemgp)

---

Top Contributors

[![diversen](https://avatars.githubusercontent.com/u/142675?v=4)](https://github.com/diversen "diversen (41 commits)")[![shemgp](https://avatars.githubusercontent.com/u/1734126?v=4)](https://github.com/shemgp "shemgp (7 commits)")[![web-elements](https://avatars.githubusercontent.com/u/3841780?v=4)](https://github.com/web-elements "web-elements (2 commits)")[![iongion](https://avatars.githubusercontent.com/u/867609?v=4)](https://github.com/iongion "iongion (1 commits)")

---

Tags

httpfiledownloadthrottleresume

### Embed Badge

![Health badge](/badges/shemgp-http-send-file/health.svg)

```
[![Health](https://phpackages.com/badges/shemgp-http-send-file/health.svg)](https://phpackages.com/packages/shemgp-http-send-file)
```

###  Alternatives

[diversen/http-send-file

Sends a file to a client, with support for (multiple) range requests. It is also able to throttle the download.

57345.2k](/packages/diversen-http-send-file)[aplus/http

Aplus Framework HTTP Library

2311.6M10](/packages/aplus-http)[padraic/humbug_get_contents

Secure wrapper for accessing HTTPS resources with file\_get\_contents for PHP 5.3+

1255.3M5](/packages/padraic-humbug-get-contents)[rtheunissen/guzzle-rate-limiter

Guzzle 6 middleware used to delay requests dynamically

52177.2k1](/packages/rtheunissen-guzzle-rate-limiter)[amphp/http-server-static-content

Static content request handler for Amp's HTTP server.

2167.2k12](/packages/amphp-http-server-static-content)[mhndev/slim-file-response

Slim File Response

112.5k](/packages/mhndev-slim-file-response)

PHPackages © 2026

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