mhndev / slim-file-response
Slim File Response
Installs: 2 459
Dependents: 0
Suggesters: 0
Security: 0
Stars: 11
Watchers: 1
Forks: 2
Open Issues: 3
Requires
- php: >=5.5.0
- slim/slim: ^3.0
This package is auto-updated.
Last update: 2024-11-06 09:32:42 UTC
README
using this package you can simply make http file response. so what FileResponse class does is, set needed http headers for file response and also getResponse method has an optional third parameter which you can provide when you want http client save file as a name other than the name which stored on server.
Sample usage
$app->get('/test/image',function($request, $response){ $filePath = '/path/to/your/image/file'; return mhndev\slimFileResponse\FileResponse::getResponse($response, $filePath); }); $app->get('/test/pdf',function($request, $response){ $filePath = '/path/to/your/pdf/file'; return mhndev\slimFileResponse\FileResponse::getResponse($response, $filePath ,'myDocument'); });