2017 © Pedro Peláez
 

library laravel-jsend

Laravel JSend Response Helper

image

evandarwin/laravel-jsend

Laravel JSend Response Helper

  • Wednesday, July 29, 2015
  • by EvanDarwin
  • Repository
  • 1 Watchers
  • 5 Stars
  • 3,630 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

JSend-Laravel

Build Status Code Climate Test Coverage, (*1)

Return JSend responses from Laravel., (*2)

Installation

In your config/app.php, you need to add our service provider:, (*3)

<?php

return array(
  // ...

  'providers' => array(
    // ...
    'EvanDarwin\JSend\Laravel\ServiceProvider'
  ),

  // ...
);

Now you need to publish the JSend configuration file, so that you can implement your own builders., (*4)

$ php artisan vendor:publish

Usage

The values that will always be included in your request are: * status * data, (*5)

All of the optional values are: * message (human readable) * code (human readable), (*6)

These message and code values are for humans to look up when they're encountering an error, but you can also do whatever you wish with it., (*7)

Example

The following code:, (*8)

<?php

class YourController extends Controller
{
    public function testStatus()
    {
        return jsend()->success()
                      ->code(100)
                      ->message("Success")
                      ->data(['allGood' => true])
                      ->get();
    }
}

Will return:, (*9)

{
    "status": "success",
    "code": 100,
    "message": "Success",
    "data": {
      "allGood": true
    }
}

License

Released under the MIT license., (*10)

The MIT License (MIT), (*11)

Copyright (c) 2015 Evan Darwin, (*12)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:, (*13)

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software., (*14)

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE., (*15)

The Versions

29/07 2015

dev-master

9999999-dev

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel json helper jsend

29/07 2015

1.2.0

1.2.0.0

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel json helper jsend

11/06 2015

1.1.1

1.1.1.0

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel json helper jsend

11/05 2015

1.1.0

1.1.0.0

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel json helper jsend

25/04 2015

1.0.2

1.0.2.0

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

laravel json helper jsend

05/03 2015

1.0.0

1.0.0.0

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

laravel json helper jsend

05/03 2015

1.0.1

1.0.1.0

Laravel JSend Response Helper

  Sources   Download

MIT

The Requires

 

laravel json helper jsend