Skip to content
No description or website provided.
Find file
Latest commit 0440d6f Mike Matz Added input_format and cleaned up handling of request data
- Added master array mapping MIME types to format keys
- Added arrays defining allowed input and output formats
- Read Content-Type header to determine input content type
- Remove all input validation from base class; this belongs in your
  application code
Failed to load latest commit information.
classes Added input_format and cleaned up handling of request data
views/webservice/default Escape code blocks in readme

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.