News Feed
Sections




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

IBM developerWorks:
Create REST applications with the Slim micro-framework
December 17, 2012 @ 12:56:24

On the IBM developerWorks site there's a new tutorial posted walking you through the process of creating a REST application with Slim, a popular microframework for PHP.

In this article, I introduce you to Slim, a PHP micro-framework that's designed for rapid development of web applications and APIs. Don't be fooled by the name: Slim comes with a sophisticated URL router and support for page templates, flash messages, encrypted cookies, and middleware. It's also extremely easy to understand and use, and it comes with great documentation and an enthusiastic developer community.

They start off by defining REST in terms of its usual four "verbs" - GET, POST, PUT and DELETE - and the conventions of the types of actions for each. Once you get the framework installed (via Composer) they help you create a sample database with an "articles" table and some sample data your service will work with. They go through each of the "verbs" and include code showing how to respond to the requests for each, including some exceptions for when things go wrong. There's also a bit about adding authentication "middleware" to the process - a hook to validate a user key as a part of the routing process. They finish things off by showing how to support multiple response formats and like XML and JSON based on the requested media type.

0 comments voice your opinion now!
slim microframework tutorial rest api interface


blog comments powered by Disqus

Similar Posts

ThinkingPHP: Google Analytics PHP API (CakePHP Model)

WeberDev.com: User Authentication With patUser (Part 1)

Zend Developer Zone: AJAX Chat Tutorial 4

Jurian Suilman's Blog: Use 3rd party modules in Zend Framework 2

Justin Carmony's Blog: Setting Up Nginx & PHP-FPM on Ubuntu 10.04


Community Events

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


series development framework release laravel5 voicesoftheelephpant community extension opinion library feature podcast language api unittest interview wordpress laravel introduction threedevsandamaybe

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