src/Controller/Frontend/DeepLink/DeepLinkAssociationController.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller\Frontend\DeepLink;
  4. use App\Web\DeepLink\Infrastructure\DeepLinkMobileAssociationConfiguration;
  5. use Symfony\Component\HttpFoundation\JsonResponse;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. final class DeepLinkAssociationController
  8. {
  9.     /** @Route("/.well-known/assetlinks.json", name="deep_link_assetlinks", methods={"GET"}) */
  10.     public function assetLinks(DeepLinkMobileAssociationConfiguration $configuration): JsonResponse
  11.     {
  12.         return $this->response($configuration->androidAssetLinks());
  13.     }
  14.     /** @Route("/.well-known/apple-app-site-association", name="deep_link_apple_app_site_association", methods={"GET"}) */
  15.     public function appleAppSiteAssociation(DeepLinkMobileAssociationConfiguration $configuration): JsonResponse
  16.     {
  17.         return $this->response($configuration->appleAppSiteAssociation());
  18.     }
  19.     /** @param array<string,mixed>|array<int,array<string,mixed>> $data */
  20.     private function response(array $data): JsonResponse
  21.     {
  22.         $response = new JsonResponse($data);
  23.         $response->headers->set('Content-Type''application/json');
  24.         $response->headers->set('Cache-Control''public, max-age=3600');
  25.         return $response;
  26.     }
  27. }