- Copy and paste files and folders to MODPATH/restful
- Copy MODPATH/restful/config/restful.php to your APPPATH/config folder
- Add this entry under
Kohana::modules
array in APPPATH/bootstrap.php :'restful' => MODPATH.'restful', // RESTful interface
- Create your a controller and extend
RESTful_Controller
(eg:class Controller_YOURNAME extends RESTful_Controller
). - Enjoy!
Four methods are already defined in MODPATH/restful/classes/restful/controller.php
protected $_action_map = array(
HTTP_Request::GET => 'get',
HTTP_Request::PUT => 'update',
HTTP_Request::POST => 'create',
HTTP_Request::DELETE => 'delete',
);
In your controller you have to define those actions:
public function action_get()
{
// some actions..
}
public function action_update()
{
// some actions..
}
public function action_create()
{
// some actions..
}
public function action_delete()
{
// some actions..
}