Skip to content
A RESTful CRUD controller for FuelPHP.
PHP
Find file
Latest commit 7313312 Jul 15, 2013 @tylermenezes Add license
Failed to load latest commit information.
classes Tiny documentation change. Apr 9, 2012
LICENSE.txt Add license Jul 15, 2013
README.md Update README, add configuration and routing info. Apr 6, 2012
bootstrap.php Initial commit Apr 6, 2012

README.md

Installation

Copy to a subfolder of fuel/packages. Add rest_crud to ['always_load']['packages'] in config.php.

Usage

For the most part, HTTP verbs map directly to functions (e.g. GET /controllername => function get()). The client can choose the return format by specifying an extension (see the documentation for Controller_Rest in FuelPHP).

GET requests can invoke one of three methods.

  • When one or more arguments are specified, it will invoke get(...).
  • When no arguments are specified, it will invoke get_list($page) (falling back to get(...)). Page is automatically populated from the "page" GET paramater (defaulting to 0) if you want to use pagination.
  • When the search GET paramater is populated, it will invoke get_search($query, $page), falling back to get_list($page), and finally get(...).

Routes

To invoke get_list with a non-default return format, you need to add a slash after the controller name. (e.g. /controllername/.json). To remove this requirement (e.g. enable /controllername.json), add this route:

'(:alnum).(:alpha)' => '$1/.$2',
Something went wrong with that request. Please try again.