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

Route Conditions and custom Not Found handler

A Coho's Avatar

A Coho

04 Dec, 2015 01:18 AM

When a route condition fails, Slim throws a 404 Page Not Found

How can I tell in custom Not Found handler ($app->notFound()) what route/condition/parameter threw the error?

  1. 1 Posted by Rob Allen on 04 Dec, 2015 07:29 AM

    Rob Allen's Avatar

    Look in $request->getAttributes('routeInfo')

  2. 2 Posted by A Coho on 05 Dec, 2015 03:00 AM

    A Coho's Avatar

    Hi Rob,

    Is this a v2 method or v3? On v2 I get an undefined method fatal error when I try to use it:

    Fatal error: Call to undefined method Slim\Http\Request::getAttributes()

  3. 3 Posted by Rob Allen on 05 Dec, 2015 02:23 PM

    Rob Allen's Avatar

    V3. Sorry. I don't know about v2.

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