Skip to content

Document available routing types #4973

@wouterj

Description

@wouterj

We seem to have no documentation on the available routing loader types that you configure when loading a resource in app/config/routing.yml. Nor do we document how Symfony determines the loader when no type is used and what the benefit of the type setting is. I've seem a couple of people asking for such docs the last weeks.

I think this can be added to book/routing directly in the "Including External Routing Resources" section.

Available loaders: yaml, php, xml, annotation (if SensioFrameworkExtraBundle is registered)

How loaders are choosen
When no type is configured, it's based on the extension. The first matching loader will be used. When a type is configured, both extension and type are taken into account. For instance, a file custom_routing.yml with type yaml will be loaded by the yaml loader, while a custom_routing.php with type yaml will not be loaded, as no loader matches both the .php extension and the yaml type.

The benefit of the type setting
Types allow you to use different loaders for the same extension, for instance a .php extension can be loaded by both the PHP and the annotation loader. Using the type annotation will make sure it's loaded by the annotation loader.

/refs symfony/symfony#13623

Metadata

Metadata

Assignees

No one assigned

    Labels

    RoutingactionableClear and specific issues ready for anyone to take them.good first issueIdeal for your first contribution! (some Symfony experience may be required)⭐️ EU-FOSSA Hackathonhttps://symfony.com/blog/the-symfony-and-api-platform-hackathon-is-coming

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy