lochmueller/http-range

Use PSR-7 messages and a PSR-15 handler/middleware to handle HTTP Range request and trigger valid partial download for streams/files. Hande multiple ranges and check different env requirements.

3.0.1 2023-07-31 14:10 UTC

This package is auto-updated.

Last update: 2024-10-21 10:46:37 UTC


README

Latest Stable Version Total Downloads License Percentage of issues still open PHPStan

Use PSR-7 messages and a PSR-15 handler/middleware to handle HTTP Range request and trigger valid partial download for streams/files. Hande multiple ranges and check different env requirements.

Usage

use Lochmueller\HttpRange\HttpRangeRequestHandler;
use Lochmueller\HttpRange\Stream\ReadLocalFileStream;

$handler = new HttpRangeRequestHandler(new ReadLocalFileStream($filePath));
$response = $handler->handle($serverRequest);
// Use response header and content

// or via middleware - HttpRangeMiddleware::class
// response is used for the range split

Tests

Run composer test to execute the current tests suite or run composer code-fix to format the code in dev context.

Problems