https://github.com/mhndev/slim-file-response
Slim File Response
https://github.com/mhndev/slim-file-response
file-response http-response slim slim3
Last synced: 5 months ago
JSON representation
Slim File Response
- Host: GitHub
- URL: https://github.com/mhndev/slim-file-response
- Owner: mhndev
- Created: 2016-06-23T15:16:16.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2021-05-04T15:54:29.000Z (over 4 years ago)
- Last Synced: 2025-05-12T19:25:31.346Z (5 months ago)
- Topics: file-response, http-response, slim, slim3
- Language: PHP
- Size: 2.93 KB
- Stars: 11
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Simple Slim Framework File Response
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
```php
$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');
});```