Skip to content

Instantly share code, notes, and snippets.

@kastaneda
Created April 27, 2011 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastaneda/944008 to your computer and use it in GitHub Desktop.
Save kastaneda/944008 to your computer and use it in GitHub Desktop.
A small suggestion
<?php
namespace Symfony\Component\HttpFoundation;
class JsonResponse extends Response
{
public function __construct($data)
{
parent::__construct(
json_encode($data),
200,
array('Content-Type' => 'application/json')
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment