Discovering Symfony and Laravel Routes with the Endpoints Tool Window
AI generated
IDE
{ }
PhpStorm · Symfony · Laravel
Discovering Symfony and Laravel Routes with the Endpoints Tool Window
Detect routes automatically and jump straight to the controller method without manual searching

In a mature Symfony or Laravel project with hundreds of routes, the question 'which controller handles this URL' is one of the most common and time-consuming lookups. The Endpoints tool window in PhpStorm answers it with a single click.

14 min read Symfony Laravel Routing Navigation

1. The problem of manual route lookup in mature projects

In a modern Symfony project, routes are annotated directly on controller methods via PHP attributes, while older projects instead centralize them in routes.yaml or spread them across several imported YAML files. Laravel, in turn, defines routes fluently in routes/web.php and routes/api.php, often with groups, middleware assignments, and resource routes that map several HTTP methods to a controller at once. In both cases, the connection between a URL and the method actually executed in code is not always obvious at a glance.

Without tool support, all that is left is a full-text search for a URL fragment or manually tracing route names step by step through several files. For a resource route like Route::apiResource('tasks', TaskController::class) in Laravel, it is also not immediately clear which of the seven automatically generated routes leads to which controller method, without keeping the Laravel conventions in mind or looking them up.

2. Opening the Endpoints tool window and understanding the base view

The Endpoints tool window is reached via View > Tool Windows > Endpoints or via Find Action by searching for 'Endpoints'. PhpStorm automatically scans the project for recognizable route definitions, both from Symfony attributes and YAML and from Laravel route files, and lists them in a central table, regardless of which file they are actually declared in.

The table shows the HTTP method, the URL path, the route name, and the responsible controller method per row. Double-clicking a row jumps directly to the definition, for Symfony attributes to the annotated method, for Laravel routes either to the line in the route file or directly to the controller method, depending on which column is clicked.


#[Route('/api/tasks/{id}', name: 'task_show', methods: ['GET'])]
public function show(int $id): JsonResponse
{
    $task = $this->taskRepository->find($id);

    return $this->json($task);
}

3. Detecting and navigating Symfony routes via attributes

In modern Symfony projects that define routes exclusively via #[Route] attributes directly on controller methods, the Endpoints tool window reads these attributes and lists them together with all specified options, such as the route name, allowed HTTP methods, and any placeholder requirements set via requirements. If the path in the attribute changes, the entry in the tool window updates automatically on the next scan.

This is especially useful for controllers with many thematically related endpoints, for instance a TaskController with separate methods for listing, viewing a single item, creating, updating, and deleting. Instead of scrolling through the class top to bottom, the Endpoints window shows all five routes at a glance, filterable and sortable by HTTP method or path, which saves time particularly when debugging a specific failing request.

4. Centralized YAML route definitions in older Symfony projects

In projects that still work with a central config/routes.yaml file or organize routes across several imported YAML files per bundle, the Endpoints tool window also recognizes these definitions and correctly resolves the controller key to the actual PHP method. This is especially valuable because mapping YAML to a PHP class purely by reading text, without IDE support, is error-prone and tedious.

In mixed projects, where some bundles use attributes and others still use YAML, the tool window lists both sources uniformly in the same table. This considerably eases a gradual migration from YAML to attributes, because progress can be read directly off the tool window, without needing to know which file a given route is currently still defined in.


task_show:
    path: /api/tasks/{id}
    controller: App\Controller\TaskController::show
    methods: [GET]
    requirements:
        id: '\d+'

5. Discovering Laravel routes including resource routes

For Laravel projects, the Endpoints tool window scans routes/web.php and routes/api.php as well as additional files imported via require or Route::group. Simple Route::get or Route::post definitions appear directly with path, method, and referenced controller method as their own row in the table.

The real added value shows up with Route::apiResource() or Route::resource(): PhpStorm knows the Laravel convention that such a line automatically generates seven routes with the standard methods index, show, store, update, and destroy, and lists each of these automatically generated routes individually, with the correct HTTP verb and the associated method on the referenced controller. Without this tool, this mapping would have to be reconstructed from memory or the Laravel documentation.


Route::apiResource('tasks', TaskController::class);

// Automatically generates:
// GET    /tasks          -> index
// POST   /tasks          -> store
// GET    /tasks/{id}     -> show
// PUT    /tasks/{id}     -> update
// DELETE /tasks/{id}     -> destroy

6. Tracing middleware and route groups in the tool window

Laravel routes are frequently defined in groups with shared middleware, for instance Route::middleware('auth:sanctum')->group(function () { ... }). The Endpoints tool window resolves such groupings and shows the fully assembled middleware chain for every single route inside the group, without having to manually trace the nesting of group definitions.

This is especially valuable when debugging a request that unexpectedly fails with 401 or 403: instead of scrolling through several nested Route::group blocks, a glance at the corresponding row in the Endpoints window immediately shows which middleware chain is actually active for that specific route, including middleware inherited from enclosing groups.

7. Filtering and searching routes deliberately

For projects with several hundred routes, the filter field at the top of the tool window is the fastest way to the target. Typing something like 'task' immediately filters to every route whose path, name, or controller contains that term, regardless of whether the route originated from a Symfony attribute or a Laravel resource route.

The table can also be grouped or sorted by HTTP method, which is helpful when searching for all destructive endpoints, meaning DELETE and in some cases PUT routes, for example as part of a security review that specifically checks which routes actually allow write access and whether they are consistently secured with appropriate middleware or Symfony security voter checks.

8. Navigating back from a controller method to its route

Navigation also works in the reverse direction: with the cursor inside a controller method, PhpStorm shows a gutter icon on the left edge of the line indicating that this method is associated with a route. Clicking this icon opens a popup with the associated route definitions and allows a direct jump to the YAML or PHP declaration.

This reverse navigation is especially valuable during refactoring: before renaming a controller method or moving it to another class, the gutter icon immediately shows whether and which route is affected, so the route reference can be updated deliberately, instead of discovering it as a 404 only after a failed deployment.

9. Practical benefit for onboarding and API documentation

For new team members getting up to speed on an existing Symfony or Laravel API project, the Endpoints tool window is often the fastest path to an overall overview of the available endpoints, considerably faster than reading through a possibly outdated external API documentation. The list in the tool window is always current, because it is generated directly from the code rather than a separately maintained documentation file.

In practice it pays off to briefly open the Endpoints window during a code review session for a new feature branch and check for newly added routes. This makes it visible whether a debug endpoint without middleware protection accidentally remained in the code before it reaches production, a mistake that is easily missed in a plain text diff of a route file.

Framework Route source What the tool window shows Navigation
Symfony #[Route] attributes Path, name, methods, requirements Double-click jumps to the annotated method
Symfony routes.yaml / imported YAML Path, resolved controller key Double-click jumps to the YAML line or PHP method
Laravel Route::get/post/... in web.php/api.php HTTP method, path, controller method Double-click jumps to the route or controller line
Laravel Route::apiResource/resource All automatically generated routes listed individually Jump to the respective resource method

Mironsoft

PhpStorm setup, Docker integration, and team productivity

PhpStorm that actually runs optimally for Magento and PHP projects?

We review existing PhpStorm setups for slow indexing, unused Docker integration, and missing team conventions, then set up a configuration that is productive from the first second.

Setup Review

Optimizing indexing, interpreter, and memory settings for large Magento projects.

Docker Integration

Cleanly connecting Xdebug, PHPUnit, and database tools to the Docker setup.

Team Conventions

Standardizing inspection profiles, code style, and live templates project-wide.

10. Summary

Endpoints Tool Window: Key Takeaways

Access

View > Tool Windows > Endpoints or Find Action with 'Endpoints'

Coverage

Symfony attributes, Symfony YAML, and Laravel route files including resource routes

Navigation

Double-click from route to controller method and back via gutter icon

Practical value

Faster API overview during onboarding and targeted review of new routes

11. FAQ: Endpoints Tool Window: Key Takeaways

1How do I open the Endpoints tool window in PhpStorm?
Via View > Tool Windows > Endpoints or via Find Action by searching for Endpoints.
2Does PhpStorm detect both Symfony attributes and YAML routes?
Yes, both sources are listed uniformly in the same tool window, regardless of how the route is declared.
3How are Laravel resource routes displayed?
Route::apiResource or Route::resource automatically generates several routes, which the tool window lists individually with the correct HTTP verb and associated controller method.
4Does the tool window also show middleware?
Yes, for Laravel routes the fully assembled middleware chain is shown, including middleware inherited from enclosing groups.
5Can I navigate back from a controller method to its route?
Yes, a gutter icon on the left edge of the method opens a popup with the associated route definitions.
6How do I find a specific route among hundreds of entries?
Via the filter field at the top of the tool window, which filters by path, name, or controller.
7Does the list update automatically when the code changes?
Yes, the tool window rescans the project and updates entries as soon as route definitions change in code or YAML files.
8Is the tool window useful in mixed Symfony projects too?
Especially there, because attribute and YAML definitions appear uniformly in the same table and ease a gradual migration.
9Does the tool window help onboard new team members?
Yes, it provides an instantly current overview of all endpoints without relying on possibly outdated external documentation.
10Can I use the tool window for security reviews?
Yes, sorting by HTTP method lets you specifically check destructive endpoints like DELETE routes for missing middleware or security voter protection.