victorandrad/laravel-response-api

Adds JSON response to API in Laravel or Lumen projects

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/victorandrad/laravel-response-api

dev-master / 0.1.x-dev 2019-07-15 11:52 UTC

This package is auto-updated.

Last update: 2025-12-16 02:10:32 UTC


README

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