exbico/jsend-response

JSend implementation in php

Installs: 9 565

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 1

pkg:composer/exbico/jsend-response

2.0.1 2020-05-28 11:41 UTC

This package is auto-updated.

Last update: 2025-09-09 12:00:59 UTC


README

#Library for JSend

You can find out more information about JSend here.

How to use

$response = new Response();
$response->setMessage('the message');
$response->setStatus(Response::ERROR);

$data = ['id' => 1];
$response->setData($data);

$newData = ['name' => 'User'];
$response->addData($newData);

$response->setVersion('v1');

echo $response;

When you print out your object, you'll get something like this:

{"status":"error","message":"the message","version":"v1","data":{"id":1,"name":"User"}}