ZH

Controller routes

Open a Symfony controller (a class in src/Controller, with #[Route], or extending AbstractController) and a Controller routes panel appears under its code, inside the editor group. It is hidden for every other file. Click its bar to collapse or expand it (the IDE remembers the choice); it follows what you type (a moment after you stop) and keeps the last good list while the code does not parse.

The bar says how many routes the controller has and the class-level prefix (#[Route('/blog', name: 'blog_')]), and has a + Add action button.

What each route shows

  • the HTTP methods (badges), the path with the class prefix merged (placeholders in colour), the route name (prefix included) and the action: click show() to go to its line;
  • requirements (requirements: and inline {id<\d+>}) and defaults;
  • parameters: the route placeholders against the method's arguments: a route value, an entity fetched by {id} or by #[MapEntity] / #[ParamConverter], #[MapRequestPayload], #[MapQueryString], #[MapQueryParameter], the current user. A placeholder the action does not take is marked "not used by the action";
  • security: #[IsGranted] on the class and on the action, denyAccessUnlessGranted() in the body, and the access_control rule of config/packages/security.yaml that the path gets (the same matcher as the Security window);
  • the templates it renders (render(), renderForm(), #[Template]): click to open the file (struck through in red when it does not exist), the routes it redirects to with redirectToRoute() (click: that route, in this controller or another), the form types it creates (click: the class), and its JSON responses ($this->json(), JsonResponse, with the keys of a literal array).

Actions

  • Open in browser: the site's address (the HTTP Client's: .env DEFAULT_URI, or the port web:serve gave the project) plus the path; each {placeholder} is asked, with a sample as proposal.
  • Send request: makes the request in the HTTP Client ({{baseUrl}} + the path, a JSON body for a #[MapRequestPayload]) in the first collection and opens it.
  • Copy URL, Copy route name.
  • + Add action: asks a name, then shows the new method (#[Route], public function name(): Response, the use lines) as a difference at the end of the class before anything is written.