2017 © Pedro Peláez
 

library laravel-restful

Create your own REST API in Laravel. Supports JSON, JSONP, and XML output.

image

kohenkatz/laravel-restful

Create your own REST API in Laravel. Supports JSON, JSONP, and XML output.

  • Tuesday, July 1, 2014
  • by kohenkatz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 24 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Restful Controller for Laravel

A base controller for laravel that handles formatting., (*1)

Installation

Composer

composer require "kohenkatz/laravel-restful", (*2)

Once you've grabbed the code, you'll need to add the RoutingServiceProvider to the list of providers in app/config/app.php as follows, (*3)

'providers' => array(
    ...
  'Kohenkatz\Restful\RoutingServiceProvider',
),

Usage

The concept uses the same principles as laravel's resource routing. Your controller should extend the one in this package. Each action should return an array which will automatically be formatted., (*4)

Add the route to app/routes.php:, (*5)

Route::resource('posts', 'PostsController');

Then add the controller as follows, (*6)

use Kohenkatz\Restful\RestfulController;

class PostController extends RestfulController {
    public function index() {
        return array(
            array(
                'id' => 1,
                'title' => 'Released a RESTful controller',
            ),
        );
    }
}

Todo

  1. Split the controller down so that the encoding happens elsewhere to allow for easier extending
  2. Add other encoders (php array, csv etc)
  3. Add more documentation
  4. Investigate if traits would be better suited for parts

The Versions

01/07 2014

dev-master

9999999-dev https://github.com/kohenkatz/laravel-restful

Create your own REST API in Laravel. Supports JSON, JSONP, and XML output.

  Sources   Download

MIT

The Requires

 

laravel rest restful routing controller

01/07 2014

v1.0.2

1.0.2.0 https://github.com/kohenkatz/laravel-restful

Create your own REST API in Laravel. Supports JSON, JSONP, and XML output.

  Sources   Download

MIT

The Requires

 

laravel rest restful routing controller

29/06 2014

v1.0.1

1.0.1.0 https://github.com/kohenkatz/laravel-restful

Create your own REST API in Laravel. Supports JSON, JSONP, and XML output.

  Sources   Download

MIT

The Requires

 

laravel rest restful routing controller