13/11
2015
Simple class to prepare standardized JSON response based on JSend specification
Simple class to prepare standardized JSON response based on JSend specification, (*1)
The preferred way to install this class is through composer., (*2)
Either run, (*3)
php composer.phar require browomir/standardized-json-response "dev-master"
or add, (*4)
// composer.json { "require": { "browomir/standardized-json-response": "dev-master" } }
to the require section of your composer.json
file., (*5)
This simple example show how you can use this class:, (*6)
require_once 'vendor/autoload.php'; use StandardizedJsonResponse\Response; $response = new Response(); $response->setStatus(Response::STATUS_SUCCESS); $response->setData( array( 'lorem' => 'ipsum' ) ); $response->setMessage('The message'); echo $response->getEncodedResponse();