Newer
Older
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
class HomeController extends AbstractController
{
public function __construct(Functions $functions)
{
$this->functions = $functions;
}
#[Route('/{fileName}', name: 'home')]
public function home(string $fileName): Response // text.txt
$filePath = $this->getParameter('kernel.project_dir') . "/public/files/" . $fileName;
foreach ($this->functions->readFileLineByLine($filePath) as $line) {
$response = new JsonResponse($text);
$response->setEncodingOptions(JSON_UNESCAPED_UNICODE);
return $response;