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.
Installs: 2 380
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
- psr/http-factory: ^1.0
- psr/http-factory-implementation: *
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- ramsey/http-range: ^1.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.17
- nyholm/psr7: ^1.8
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.2
README
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.