Skip to content

urlFor() is a misnomer; proposal for pathFor() and/or an actual urlFor() in 3.x #1316

Description

@rszrama

I'm taking the time to learn Slim 3.x after learning about it from Josh, and I came across this function in the Router. It's very helpful, but it's a misnomer in that it doesn't actually provide URLs for named routes. It provides paths to those routes with argument replacement. It lacks the protocol or domain name that would be required for the return value to be considered a URL.

To remedy this, I propose at least renaming the existing function to pathFor(), which is still very useful i its own right. If you wanted, you could then also provide a urlFor() function that includes the protocol and domain in its return value. (I wouldn't recommend doing what Drupal has done by overloading url() to return either a path by default or a full URL if 'absolute' => TRUE.)

I'm happy to submit a pull request in this direction but figured it best to get feedback before doing so. 😄

Metadata

Metadata

Assignees

No one assigned

    Labels

    Slim 3pending responseWaiting on a response from the original poster

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions