Skip to content

victorandrad/laravel-response-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}

About

Response for Laravel or Lumen API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages