11. Downloads - nathan-fiscaletti/synful GitHub Wiki
You can make a response download as a file using the following:
return sf_response(
200, [
'data' => 'This is the content of the file'
]
)->downloadableAs('filename.txt');
This will set the Response Serializer to an instance of DownloadSerializer and append a Content-disposition
header to the response.
See DownloadExample.php Request Handler and Response.php
downloadableAs
function