ericliao79 / laravel-respond-format
规范化响应API格式。
v2.1.1
2018-05-18 01:49 UTC
Requires
- php: >=7.1
- league/fractal: ~0.13
Requires (Dev)
- illuminate/contracts: ~5.0
- illuminate/http: ~5.0
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
README
在团队合作中,经常会遇到不同的API响应格式,laravel-respond-format整合了一些常见的响应到laravel辅助函数中,使这变得更简单和清晰。
安装
$ composer require maras0830/laravel-respond-format ^v2.0
或者
"require": { "maras0830/laravel-respond-format": "^v2.0" // Add this line }
使用
return not_found();
示例:数据未找到响应
{ "error": { "message": "Data not found.", "code": 404, "type": "not_found" } }