Route Action Controller - No Route Found

v2026.

I am trying to create a route as follows

  1. Created a custom file with the name “RouteActionController.php” , I kept caption blank and unselect the include common file

  2. the file is generated under the root directory of project folder.

  3. the code I use in RouteActionController.php

  4. <?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”

  1. Note that controllers must be generated in the controllers folder, read Example - Add Controller. Otherwise the controllers and the routes are not auto-loaded.

  2. Don’t use old code arguments (ServerRequestInterface $request, ResponseInterface $response, RouteArgs $args) anymore, use new (and better) arguments, read Migrating to v2026 → Routing Changes.