Skip to content

A Simple way to define your Json Response for your Api in Laravel

Notifications You must be signed in to change notification settings

Kepsondiaz/HttpJsonBridge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel HttpJsonBridge 🌉

A simple way to define your Json Response for your Laravel's Api .

installation

composer require kepsondiaz/httpjsonbridge

Doc

Send a response based on the event that occurs when your api is called

send a Response when a badRequest occur. Status code 400

/**
 * Response with status code 400.
 */
return (new \Kepsondiaz\HttpJsonBridge\HttpJsonBridge)->badRequestApiResponse([
                'message' => 'your custom message for response'
            ]);

send a Response when response is OK.

/**
 * Response with status code 200.
 */
return (new \Kepsondiaz\HttpJsonBridge\HttpJsonBridge)->okApiResponse([
                // do something
            ]);

send a Response when response when resource is not found

/**
 * Response with status code 404.
 */
return (new \Kepsondiaz\HttpJsonBridge\HttpJsonBridge)->notFoundApiResponse([
                // do something
            ]);

send a Response when response when user is unauthorised

/**
 * Response with status code 401.
 */
return (new \Kepsondiaz\HttpJsonBridge\HttpJsonBridge)->unauthorizedApiResponse([
                // do something
            ]);

About

A Simple way to define your Json Response for your Api in Laravel

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages