Skip to content

[Routing] free controllers from their folder #60946

Open
@Nayte91

Description

@Nayte91

Description

Hi there,

Part of the folder-free initiative, controllers are unfortunately not totally movable right now,

Thing is a config in config/route.yaml wants to know where the controllers are and what the namespace is; I feel like those parameters are artifact of the old system, and maybe we can get rid of them to just let the container check in all src/default code folder, list the controllers (#[AsController], #[Route] or extends AbstractController) once and for all, cache them and live with it? Could it be a perfect fit for deprecation 7.4/removal 8.0?

This would save few lines of config, again, and improve DX by letting dev choose where to put the controllers... Problem is maybe the same than Doctrine's ORM Entity scan, as I don't know if right now, if I tell the config "scan all src/" I will not crash the performances, or create weird bugs?

Example

Current:

  • src/
    • Controller/
      • OrganizationController.php

Instead:

  • src/
    • Organization/
      • Controller/
        • MyInvokableIndexController.php
        • GeneralCrudController.php

Metadata

Metadata

Assignees

No one assigned

    Labels

    DXDX = Developer eXperience (anything that improves the experience of using Symfony)FeatureRouting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions