devboxr / response-helper by devboxr

A simple response helper that I use for my Laravel/Lumen 5+ projects.
1,657
0
1
Package Data
Maintainer Username: devboxr
Maintainer Contact: devboxr@gmail.com (devboxr)
Package Create Date: 2016-04-14
Package Last Update: 2016-04-15
Home Page:
Language: PHP
License: Unlicense
Last Refreshed: 2024-11-23 03:07:53
Package Statistics
Total Downloads: 1,657
Monthly Downloads: 1
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

devboxr/response-helper

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.']);