exbico / jsend-response
JSend implementation in php
2.0.1
2020-05-28 11:41 UTC
Requires
- php: >=7.1
- ext-json: *
Requires (Dev)
- codeception/codeception: ^2.4
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"}}