Best Restful Micro PHP Framework with Code Example and Tutorial

best restfull micro php frameworkCreating a web service without framework is very hard. Web service is an application that can be accessed via the URL or Restful. Most web service use restful  to interact with client, the reason is easy to use and simple. You can open a web service easily. With restfull micro PHP framework, you can build a web service quickly, easy and secure. There are many options restfull PHP framework you can choose, in the list below I put together a few restful micro PHP framework, completed with example code.

For example,  you want to create a web service to serve real- time data transport in a town. This web service can be accessed from anywhere, even can be accessed via mobile devices. You can also open a commercial web service, for example, the data soccer live, premium content networks like newscreed and others.

Restful micro PHP framework is certainly not a big framework, and may not be implemented for a large project. This framework is suitable for learning, however, you can still use this framework to a real project in real life.

1. Recess – Restful PHP Framework


Recess is open source restful php framework that designed for easy building web service. Recess is fast, light-weight, and has a very small footprint—ideal for LAMP development and drag-and-drop deployment to shared hosts. Thanks you Kris Jordan for creating this awesome framework. Download

2. Flight Resfull PHP Framework


Flight is very lightweight restfull PHP framework. You can easily and quickly creating web service with this awesome stuff.

require 'flight/Flight.php';

Flight::route('/', function(){
    echo 'hello world!';


Another code, you can access it here. I think the code is very easy to learn and read. Everyone can understand it. Download

3. Tonic Restfull PHP Framework


Tonic is open source restful php framework to build web service.  Download

 * @uri /hello
 * @uri /hello/:name
class Hello extends Tonic\Resource {

     * @method GET
     * @provides text/html
    function sayHello($name = 'World') {
        return 'Hello '.$name;

4. Grape Restfull PHP Framework


Grape allows you to build lightweight APIs with Ruby when you don’t need the heavy lifting power of large frameworks like Rails. It’s a REST-like API micro-framework built to complement existing web application frameworks by providing a simple DSL to easily provide APIs


5. Toro restfull php framework


Toro is a PHP router for developing RESTful web applications and APIs. It is designed for minimalists who want to get work done.

Code example :

class MainHandler {
    function get() {
        echo "Hello, world";
    "/" => "MainHandler",

I think, using toro is not hard, codes are easy to learn. Beginners are welcome. Download

6. BulletPHP Restfull Framework

Bullet is a functional PHP micro-framework that helps you easily create REST APIs and web applications that automatically conform to the requirements of the HTTP specification.

Code example

$app = new Bullet\App(array(
    'template.cfg' => array('path' => __DIR__ . '/templates')
// 'blog' subdirectory
$app->path('blog', function($request) use($app) {
    $blog = somehowGetBlogMapper(); // Your ORM or other methods here
    // 'posts' subdirectory in 'blog' ('blog/posts')
    $app->path('posts', function() use($app, $blog) {
        // Load posts once for handling by GET/POST/DELETE below
        $posts = $blog->allPosts(); // Your ORM or other methods here
        // Handle GET on this path
        $app->get(function() use($posts) {
            // Display all $posts
            return $app->template('posts/index', compact('posts'));
        // Handle POST on this path
        $app->post(function() use($posts) {
            // Create new post
            $post = new Post($request->post());
            return $this->response($post->toJSON(), 201);
        // Handle DELETE on this path
        $app->delete(function() use($posts) {
            // Delete entire posts collection
            return 200;
// Run the app and echo the response
echo $app->run("GET", "blog/posts");

Real app example : scrum pocker. I think BulletPHP is hard to learn, maybe suitable for advance programmer.

Download this framework, here

7. Frapi

Is a restful framework that focuses on the system, so as to better serve the request. FRAPI takes care of handling multiple media types, returning the correct response codes, generating API documentation, and much more. Find FRAPI on Github

8. Slim Framework

slim framework

Slim is a PHP micro framework is popular lightweight PHP framework and restfull framework. There are many tutorial how write code to building web service with slim framework. Actually Slim Framwork is not restfull framework in specifically (such as cakephp), but he has Restfull feature, so I incorporate it into this list.

Some tutorial to creating web service with Slim


And many more.

You can download Slimframework here

9 thoughts on “Best Restful Micro PHP Framework with Code Example and Tutorial

  1. I think that Slim is the best one, beacuse we can build middlewares that are extremely useful to make your app secure and reduce code writing.
    Congrats for the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.