v2026.
I am trying to create a route as follows
-
Created a custom file with the name “RouteActionController.php” , I kept caption blank and unselect the include common file
-
the file is generated under the root directory of project folder.
-
the code I use in RouteActionController.php
-
<?php namespace PHPMaker2026\CashSmsMobile; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; use Symfony\Component\Routing\Annotation\Route; // #[IsGranted('IS_AUTHENTICATED')] // Note: Uncomment if security is required class RouteActionController { #[Route('/myfirstroute', methods: ['GET'])] public function action1(ServerRequestInterface $request, ResponseInterface $response, RouteArgs $args): ResponseInterface { $output = [ "status" => "ok", "particular" => "myfirstroute" ]; return $response->withJson($output); } }
when I try to access the route by the url as - http://localhost/myfirstroute
I got an error as
No route found for “GET http://localhost/myfirstroute”