Skip to content

Instantly share code, notes, and snippets.

@james2doyle
james2doyle / slim-stream-route.php
Created January 10, 2018 06:05
Create a streaming download of a large file with Slim PHP using the build in Stream class
<?php
use Slim\Http\Request;
use Slim\Http\Response;
use Slim\Http\Stream;
$app->get('/stream', function (Request $request, Response $response, array $args) {
// a 100mb file
$path = '../public/files/document.pdf';