Skip to content

Allow dash in route placeholders #13400

@garwat82

Description

@garwat82

I'm using a component library that uses dashes ("-") in parameter name. The current implementation of Symfony routes doesn't allow dashes in placeholders like /detail/{d-product-id}.

I've tried to make a patch that changes this behavior by modifying the regex to "{[\w-]+}" which worked fine for generating URLs. The other way round to extract the parameter values and assign them to the placeholder (d-product-id) seems much more complicated as the RouteCompiler class uses named regex placeholders (P(...)) and "name" must only consist of word characters. Also, if values should be injected as parameters in actions, dashes are not allowed.

Is there a possibility to get an implementation that accepts dashes in placeholders?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions