entomb/slim-json-api — pull request #6 by bignall (2013-11-26 19:35:54+00:00)
Title: Add flash messages to the response

$this->data->flash is a Slim flash object, thus json_encode($this->all()) results in { 'flash': {}, ...} instead of the actual messages. This pull request, puts $this->all() into $response, then adds the actual messages ($this->data->flash->getMessages()) to $response['flash'], and json_encodes($response). The result is { 'flash': {'your flash key': 'your flash message', ...} ... }. Now you can use flash messages in your app and return them in the json.