https://github.com/professorhaseeb/smartoutput
Smart Output for RESTful PHP APIs
https://github.com/professorhaseeb/smartoutput
api api-response response rest rest-api restful restful-api
Last synced: 6 months ago
JSON representation
Smart Output for RESTful PHP APIs
- Host: GitHub
- URL: https://github.com/professorhaseeb/smartoutput
- Owner: professorhaseeb
- License: mit
- Created: 2016-04-20T11:32:08.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-06T11:22:20.000Z (over 9 years ago)
- Last Synced: 2024-04-20T02:42:01.603Z (about 2 years ago)
- Topics: api, api-response, response, rest, rest-api, restful, restful-api
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Smart Output - [](https://travis-ci.org/professorhaseeb/smartOutput)
##Installation
```
composer require professorhaseeb/smart-output
```
##Usage
```php
// setup class
$so = new smartOutput();
```
Setting Response:
```php
//set response code in first parameter and the response output in the second
$so->setResponse(0,"RESPONSE DATA");
// Array can be passed too
// $arr = ("request" => "true");
// $so->setResponse(0,$arr);
```
Get Response:
```php
echo json_encode($so->getResponse());
```
Output:
```json
{
"status_code": 0,
"status": "success",
"message": "Request successfull",
"response": "RESPONSE DATA"
}
```