Skip to content

This package can help you simplify the way you create a JSON response structure, making it consistent and easy to maintain.

Notifications You must be signed in to change notification settings

silverhand7/laravel-api-response-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel API Response Wrapper

If you get tired of rewriting your JSON structure in every response, this package could be something you need. I believe that rewriting every JSON structure manually could lead to inconsistent JSON structures and be hard to maintain. If somehow we want to change the JSON response format, we have to change it in every location.

What this package does?

This package can help you simplify the way you create a JSON response by using its facade accessor like ApiResponseWrapper::get("", $data), and the output will be something like:

HTTP OK 200
{
  "success": true,
  "message": "",
  "data": {...}
}

Installation

composer require silverhand7/laravel-api-response-wrapper

Available Response

get

ApiResponseWrapper::get($message, $data)
Params type
$message ?string
$data array|Collection

created

ApiResponseWrapper::created($message, $data)
Params type
$message ?string
$data array|Collection

About

This package can help you simplify the way you create a JSON response structure, making it consistent and easy to maintain.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages