2017 © Pedro Peláez
 

library uniform-json-responses

A PHP trait to uniform http responses.

image

foothing/uniform-json-responses

A PHP trait to uniform http responses.

  • Monday, June 19, 2017
  • by brazorf
  • Repository
  • 1 Watchers
  • 0 Stars
  • 28 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 22 % Grown

The README.md

PHP Uniform HTTP responses

This is a tiny package meant to be used within Laravel. It defines a trait that can be used to wrap and uniform JSON responses to a reusable format., (*1)

Install

composer require foothing/uniform-json-responses, (*2)

Usage

Simply add the trait to your Controller and have your controller actions to return content via the trait success or fail api., (*3)

class FooController {

    use WrapsResponses;

    public function getIndex() {
        // Do stuff
        return $this->success($dataToBeJSONed, 'Hey! It works.');
    }

    public function putIndex() {
        // Do more bad stuff.
        return $this->fail("Doh, this is broken", 500);
    }

}

The messages you can pass along with success and fail will be included in a X-Status-Message header., (*4)

The Versions

19/06 2017

dev-master

9999999-dev

A PHP trait to uniform http responses.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar brazorf

19/06 2017

0.1.0

0.1.0.0

A PHP trait to uniform http responses.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar brazorf

22/07 2016

dev-develop

dev-develop

A PHP trait to uniform http responses.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar brazorf