2017 © Pedro Peláez
 

library restrouter

image

cyber-duck/restrouter

  • Tuesday, September 2, 2014
  • by cyber-duck
  • Repository
  • 15 Watchers
  • 1 Stars
  • 36 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

🚨 Discontinued 🚨

This functionality is redily available in later versions of Laravel using Route::resource()., (*1)

Laravel REST Routes

An extension to the Laravel Router to add an extra method ->rest() which creates RESTful routes similar to Laravel's built in resource., (*2)

Installation

Add the package to your composer.json and run composer update., (*3)

{
    "require": {
        "cyber-duck/restrouter": "dev-master"
    }
}

Add the service provider in app/config/app.php:, (*4)

'CyberDuck\RestRouter\RestRouterServiceProvider',

This will add our route class to the IoC container in place of the default, everything will work as standard with the addition of Route::rest(), (*5)

Example Usage

[app/routes.php]

<?php
$options = ['model' => 'ResourceModel'];
Route::rest('resource-name', 'ResourceController', ['model' => 'Models\Resource']);

This is will register the following routes:, (*6)

URI Name Action
GET HEAD resource-name resource.index | ResourceController@index
POST resource-name resource.store ResourceController@store
GET HEAD resource-name/{models_resource}/{_path?} resource.show | ResourceController@show
PUT resource-name/{models_resource}/{_path?} resource.replace ResourceController@replace
PATCH resource-name/{models_resource}/{_path?} resource.update ResourceController@update
DELETE resource-name/{models_resource}/{_path?} resource.destroy ResourceController@destroy
GET HEAD POST|PUT|PATCH|DELETE resource-name/{_missing} | | ResourceController@missingMethod

{_path} will capture the remainder of the path after matching the first part. The controller is also RESTful if you need to add any additional routes., (*7)

Options include model, except and only and work the same as resource(), (*8)

The Versions

02/09 2014

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mark Garratt

02/09 2014
26/08 2014