browomir/standardized-json-response

Simple class to prepare standardized JSON response based on JSend specification

1.0.0 2015-11-06 21:01 UTC

This package is not auto-updated.

Last update: 2024-11-09 18:32:54 UTC


README

Simple class to prepare standardized JSON response based on JSend specification

Installation

The preferred way to install this class is through composer.

Either run

php composer.phar require browomir/standardized-json-response "dev-master"

or add

// composer.json
{
    "require": {
        "browomir/standardized-json-response": "dev-master"
    }
}

to the require section of your composer.json file.

Usage

This simple example show how you can use this class:

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();

Build Status Scrutinizer Code Quality Code Coverage Latest Stable Version Latest Unstable Version Dependency Status Total Downloads License