LaravelPackages.net
Acme Inc.
Toggle sidebar
victorandrad/laravel-response-api

Adds JSON response to API in Laravel or Lumen projects

2
0
About victorandrad/laravel-response-api

victorandrad/laravel-response-api is a Laravel package for adds json response to api in laravel or lumen projects. It currently has 0 GitHub stars and 2 downloads on Packagist. Install it with composer require victorandrad/laravel-response-api. Discover more Laravel packages by victorandrad or browse all Laravel packages to compare alternatives.

Last updated

Response API

About

The laravel-response-api package allows you to standardize the responses of your api that will be consumed.

Installation

Require the victorandrad/laravel-response-api package in your composer.json and update your dependencies:

$ composer require victorandrad/laravel-response-api

Global usage

To use Response you must include it in your Controller, include the in the return of your method you want it to return:

public function User {
	//return success
	$json = //my object
	return Response::json(ResponseUtil::makeResponse('DONE', $json), Response::HTTP_OK);
	
	//return error
	$json = //my object
	return Response::json(ResponseUtil::makeError('NOT_FOUND', $json), Response::HTTP_NOT_FOUND);
}

Star History Chart