Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Web service module for Kohana 3.0.x

This is a simple module providing a groundwork for "RESTful" web services in Kohana 3. Current functionality includes automatic action remapping and multiple output formats (HTML, JSON, XML, PHP).


  • Extend WebService_Controller_Base in one of your application controllers.
  • Create actions to respond to desired HTTP methods: action_index (GET), action_update (PUT), action_create (POST), action_delete (DELETE). Return response data to user via $content member variable.
  • Optionally customize $_format_map to contain your supported list of formats. Default is html, json, xml, php.
  • Optionally create custom views for each supported format. Defaults go in views/webservice/default/<format>.php.
  • Optionally create custom views for your controller. View search path is views/<controller>/<action>/<format>.php, views/<controller>/<default>/<format>.php, and finally views/webservice/default/<format>.php.
  • Optionally create a custom route that captures a <format> request parameter.

Custom route example:

Route::set('webservice', '(<controller>(/<id>))(.<format>)')
        'controller' => 'demo',
        'action'     => 'index',
Something went wrong with that request. Please try again.