dannykopping/Slim — comment on commit 3fdc30d98d5038ec9520420fa6d81ef9de24b8a7
File:  line 0
By codeguy:

One last follow up for tonight. Here's all it would take to derive a `JsonResponse` class from `Slim_Http_Response`:

class JsonResponse extends Slim_Http_Response {
public function write( $json ) {
$this['Content-Type'] = 'application/json';
parent::write(json_encode($json));
}
}

Used like this:

$app->get('/foo.json', function () {
return new JsonResponse(array(
'name' => 'Danny'
));
});