Restful Web Services Using Slim PHP Framework

In this article, we’ve discussed creating a RESTful web service using the Slim framework. Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.


API Router

The Slim Framework helps you map resource URIs to callback functions for specific HTTP request methods (e.g. GET, POST, PUT, DELETE, OPTIONS or HEAD). A Slim application will invoke the first route that matches the current HTTP request’s URI and method.


Build your application with custom concentric middleware to tweak the HTTP request and response objects before and after your Slim app runs.

HTTP Request

Slim has an easy-to-use request and response abstractions that let you inspect and manipulate HTTP messages’ method, status, URI, headers, cookies, and body.


Slim provides first-class session support. It persists session data using industry standard encryption. Slim also enables “flash” messages across requests.


Slim provides helper methods that make client-side HTTP caching easier. It helps you work with the Expires, Last-Modified, and ETag headers.


Slim has super-secure cryptography using military-grade encryption. Slim uses your unique key to encrypt session and cookie data before persisting data to disk.

An example to print Hello to Slim World

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Article Tags: , ,