sinclairt/responses

Standardise success and failure responses to both server and client side processing

1.0.13 2017-03-29 12:30 UTC

This package is not auto-updated.

Last update: 2024-12-22 04:01:29 UTC


README

The responses package give you standardised responses for all your calls whether they are server side or client side

Installation

composer require sinclairt/responses

Register the service provider: Sinclair\Responses\SinclairResponsesServiceProvider

composer dump-autoload

Usage

You can use the controller responses doStore and doUpdate to standardise your actions for a resourceful controller (store and update respectively).

The SinclairResponse class takes care of organising your content and returning it appropriate either as JSON or a as a redirect with a message in the session.

The methods are SinclairResponse::success() and SinclairResponse::failure() passing in any arguments you want to return back in the response.