novaday-co/laravel-api-response

This Package helps developers to easily make response for API

dev-master 2021-08-03 04:18 UTC

This package is auto-updated.

Last update: 2024-10-29 06:12:50 UTC


README

Laravel API Response package

Laravel API Response

This Package helps developers to easily make response for API . Add extra data to collection response . Short magic method that use your translate files to set messages .

How to install :

composer require novaday-co/laravel-api-response

How to use :

Success response

Api::success("Successful Action")->response();

Success response

Api::success("Successful Action")->response();

Failure response

Api::failure("Failed")->response();

Custom response

Api::customResponse(201,'Created Successfully',['key'=>'value'])->response();

With data

Api::success('Ok',['key'=>'value'])->response();

External data in data

Api::success('Ok',[ User::all() ])->withData([ Customer::first() ])->response();

External data next to data

Api::success('Ok',[ User::all() ])->with([ 'Customers' => Customer::all() ])->response();

Short magic method for set messages

Api::updated()->response();