simple-response
Simple package to handle response properly in your API. This package does not include any dependency.
Install
Via Composer
$ composer require phuongdanh/simple-response
Requirements
The following versions of PHP are supported by this version.
- PHP 5.6
- PHP 7.0
- PHP 7.1
- PHP 7.2
- PHP 8.x
How to use it?
// Use namespace
use SimpleResponse\Response;
// response with default data type based on Accept value in request's header
return Response::default($your_data);
// response as application/json
return Response::json($your_data);
// response as text/xml
return Response::xml($your_data);
License
The MIT License (MIT). Please see License File for more information.