PHP Class Webiny\Component\Http\Response\JsonResponse

Inheritance: extends Webiny\Component\Http\Response, use trait Webiny\Component\StdLib\StdLibTrait
Mostrar archivo Open project: Webiny/Framework Class Usage Examples

Public Methods

Method Description
__construct ( string | array | ArrayObject $content, array $headers = [], boolean $prettyPrint = false ) Base constructor.
sendJson ( string | array | ArrayObject $content, array $headers = [] ) Creates a JsonResponse instance and sends the output to the browser.

Method Details

__construct() public method

Base constructor.
public __construct ( string | array | ArrayObject $content, array $headers = [], boolean $prettyPrint = false )
$content string | array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject Json content.
$headers array Headers to attach to the response.
$prettyPrint boolean Should we use JSON_PRETTY_PRINT to nicely format the output.

sendJson() public static method

This is just a short hand method for creating a new JsonResponse instance and then calling the "send" method.
public static sendJson ( string | array | ArrayObject $content, array $headers = [] )
$content string | array | Webiny\Component\StdLib\StdObject\ArrayObject\ArrayObject Json content.
$headers array Headers to attach to the response.