Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kosmosx/response
Response HTTP package for Simfony, Laravel, Lumen and PHP 7 with standard REST API
https://github.com/kosmosx/response
hateoas-response http-foundation json-response laravel laravel-package lumen lumen-package package response-management rest-api restful-api symfony symfony-api symfony-bundle
Last synced: 27 days ago
JSON representation
Response HTTP package for Simfony, Laravel, Lumen and PHP 7 with standard REST API
- Host: GitHub
- URL: https://github.com/kosmosx/response
- Owner: KosmosX
- Created: 2018-11-04T19:50:53.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-19T17:44:28.000Z (over 5 years ago)
- Last Synced: 2024-10-03T07:05:55.481Z (about 1 month ago)
- Topics: hateoas-response, http-foundation, json-response, laravel, laravel-package, lumen, lumen-package, package, response-management, rest-api, restful-api, symfony, symfony-api, symfony-bundle
- Language: PHP
- Homepage: https://packagist.org/packages/kosmosx/response
- Size: 97.7 KB
- Stars: 16
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Documentation
![](https://img.shields.io/badge/version-1.0.2-green.svg)
![](https://img.shields.io/badge/Laravel->=7.1-blue.svg)
![](https://img.shields.io/badge/Symfony->=4.2-blue.svg)### Let's go
**Composer**composer require kosmosx/response
require __DIR__ . '/vendor/autoload.php';
$response = new Kosmosx\Response\RestResponse();$handler = Kosmosx\Response\Exceptions\Handler();
$handler->setExceptionHandler();**use it**
$response = new Kosmosx\Response\RestResponse($content, $status, $headers); //constructor
$response = new Kosmosx\Response\Factory\FactoryResponse::success(); //factory
$response->withData(true); //add to json array with key 'data'
## Example$response->success()
->withData(['test' => true])
->withData(['test2' => false])
->withMessage('Microservice Lumen work')
->withState();
//response
{
"data": {
"test": true,
"test2": false
},
"messages": "Microservice Lumen work",
"state": "OK"
}
**en**: [documentation](https://github.com/FabrizioCafolla/response-http/wiki/Response-http-documentation)**it**: [documentazione](https://github.com/FabrizioCafolla/response-http/wiki/Documentazione-response-http)
***
If you find a bug or want to contribute, write to [email protected]