News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Lorna Mitchell's Blog:
Building A RESTful PHP Server Routing the Request
January 23, 2012 @ 11:14:11

Lorna Mitchell is back with a second installment in her "Building a RESTful PHP Server" series with this new post about handling and routing the incoming requests. (You can find the first part about working with the request here)

This is the second part of a series, showing how you might write a RESTful API using PHP. This part covers the routing, autoloading, and controller code for the service, and follows on from the first installment which showed how to parse the incoming request to get all the information you need.

She shows how to grab the controller name from the incoming request (based on her previous code), create the object for it and execute the requested action name. Also included is a sample autoloader and a basic controller - a UsersController with "getAction" and "postAction" methods for responding to GET and POST requests.

0 comments voice your opinion now!
restful server tutorial request routing controller get post action


blog comments powered by Disqus

Similar Posts

Artur Ejsmont's Blog: How to build mongodb pecl extension in 32bit for PHP 5.2 on OSX Snow Leaopard

Site News: Blast from the Past - One Year Ago in PHP

Site News: Popular Posts for the Week of 11.16.2007

Vinu Thomas' Blog: Create a Storage engine for MySQL using PHP

IBM developerWorks: Cloud computing with PHP, Part 1: Using Amazon S3 with the Zend Framework


Community Events





Don't see your event here?
Let us know!


community security podcast mvc composer interview release symfony language voicesoftheelephpant series package framework library version laravel tool introduction update opinion

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework