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

Slim 3 Helper Class to Automate Json Response

-'s Avatar


12 Jun, 2015 02:40 PM

Hi, I'm totally new to Slim and recently started learning/building using the develop branch. Loving it so far but curious if I'm doing something the correct way. I'm attempting to build some helper functions that will automate my json responses. See gist >>

Then, from my controller: return $this->json->error(404, 'Something failed', 'A more detailed explanation of the failure.');

Can anybody tell me if I'm going about this the correct way or am missing something important? I appreciate any feedback. Thanks!

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