/** * @param $projectId * @param $fileId * @return array|\Symfony\Component\HttpFoundation\BinaryFileResponse */ public function showFile($projectId, $fileId) { $file = $this->service->getFile($projectId, $fileId); $filePath = $this->service->getFilePath($projectId, $fileId); $fileContent = file_get_contents($filePath); $fileContent64 = base64_encode($fileContent); return ['name' => $file->file, 'file' => $fileContent64, 'size' => filesize($filePath)]; }