devboxr / response-helper
A simple response helper that I use for my Laravel/Lumen 5+ projects.
This package's canonical repository appears to be gone and the package has been frozen as a result.
0.0.5
2016-04-15 10:36 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2025-03-13 02:37:00 UTC
README
A simple response helper that I use for my Laravel/Lumen 5+. Its very simple goal is to have unified responses across a specific project. I may implement a "Problem Details" inspired approach http://datatracker.ietf.org/doc/draft-nottingham-http-problem/.
Installation
Composer install: composer require devboxr/response-helper
Use
<?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.']);