I would like to create an API which returns a text file. In Symfony I have a controller which is :
throw $this->createNotFoundException($message);
}
$response = new Response();
$response->headers->set('Content-Type', "text/cfg;charset=utf-8");
$response->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '.cfg"');
$response->headers->set('Pragma', "no-cache");
$response->headers->set('Expires', "0");
$response->headers->set('Content-Transfer-Encoding', "binary");
$response->headers->set('Content-Length', strlen($data));
$response->setContent($data);
return $response;
Is there any alternative option with api-platform to explain this format ? I'm in symfony 4 with api-plateform
Thanks in advance