The Slim Framework support forum has moved to This Tender forum is no longer maintained or monitored.

Multiple routes with the same signature

paul.godley's Avatar


18 Jan, 2016 03:27 PM

Hi there, apologies if this is a daft question. I am looking at loading routes from various files, with newer versions taking precedence over older routes. If I try and have two routes with the same signature, an error is generated. Is there any way to load routes from multiple locations with the latest one overriding the previous?

For instance if we have a route in v1.php and we then load a route from v2.php with the same signature but a different method body, is there anyway for the routing to call this later method?

Many thanks,

  1. 1 Posted by alex on 06 Feb, 2016 05:01 PM

    alex's Avatar

    I have this same requirement (Slim 2). My application has a set of "core" routes, which I would like to allow plugin developers to override by redeclaring routes with the same signature (URI and HTTP verb).

    It would appear that you can indeed declare routes multiple times, and the first declaration takes precedence. However, I am not sure if this is a reliable behavior. I also notice that the opposite is true of the notFound handler.

  2. 2 Posted by paul.godley on 08 Feb, 2016 10:58 AM

    paul.godley's Avatar

    Hi Alex, I posted the same question on Stack Overflow and got a very thorough response here ( This is aimed at Slim v3 however, but hopefully it will help.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac