exbico / jsend-response
JSend implementation in php
Installs: 9 564
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 1
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"}}