devboxr / response-helper
一个简单的响应助手,我用于我的Laravel/Lumen 5+项目。
0.0.5
2016-04-15 10:36 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-09-26 00:26:45 UTC
README
这是一个简单的响应助手,我用于我的Laravel/Lumen 5+项目。它的主要目标是实现项目内的统一响应。我可能会实现一个受“问题详情”启发的方案http://datatracker.ietf.org/doc/draft-nottingham-http-problem/。
安装
Composer安装: composer require devboxr/response-helper
使用
<?php use Devboxr\Helpers; /** * There are more examples and the ResponseHelper is extended all the time. */ // will return a status 200 ResponseHelper::success(); // will return a status 404 ResponseHelper::notFound(); // will return a status 500 ResponseHelper::serverError(); // Server error 500 with a reason ResponseHelper::serverError(500, ['error' => 'Could not contact external provider.']);