moudarir/downloader

Modern PHP download library with RFC 9110 support.

Maintainers

Package info

github.com/moudarir/downloader

pkg:composer/moudarir/downloader

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-08-07 09:54 UTC

This package is auto-updated.

Last update: 2026-08-07 10:01:39 UTC


README

A lightweight and modern PHP library for streaming files and in-memory data with full support for HTTP conditional requests and byte range requests.

Features

  • PHP 8.4+
  • File downloads
  • In-memory data downloads
  • HTTP Range Requests (RFC 9110)
  • Multipart byte ranges
  • ETag support
  • Last-Modified support
  • Conditional requests
  • HEAD requests
  • X-Sendfile support
  • X-Accel-Redirect support
  • UTF-8 filenames (RFC 6266)
  • No external dependencies

Installation

composer require moudarir/downloader

Download a file

use Moudarir\Downloader\Download;

Download::fromFile('/path/to/file.pdf')
    ->stream();

Download in-memory data

Download::fromData($content, 'report.csv', 'text/csv')
    ->stream();

Inline display

Download::fromFile($file)
    ->inline()
    ->stream();

Custom headers

Download::fromFile($file)
    ->addHeader('Cache-Control', 'public, max-age=3600')
    ->stream();

HTTP Features

The library automatically supports:

  • ETag
  • Last-Modified
  • If-Match
  • If-None-Match
  • If-Modified-Since
  • If-Unmodified-Since
  • Range Requests
  • If-Range
  • HEAD requests

All conditional request evaluation follows RFC 9110.

License

MIT