PHP RESTful CRUD framework

Dnns picture Dnns · Oct 25, 2013 · Viewed 31.3k times · Source

I really like working with SailsJS (http://sailsjs.org). Especially because it automatically generates a RESTful CRUD API. However, working for small clients, I don't always have the opportunity of working in a NodeJS environment. Mostly their webapps run on an Apache (PHP/MySQL) server.

My question: Is there any framework that provides an automatically generated RESTful CRUD API? If not, what is the best approach to write it myself?

I'm aware of frameworks that handle routing, however I'm looking for something that automatically generates CRUD API (based on blueprints or linked to the database tables).

For speeding up the development process and keeping my code clean I also like ORM's. It would be nice if I could link the automatically generated API to the ORM schema/blueprint. So once again, what is the best way to approach this?

I couldn't find any frameworks that provide this. Hope you guys can help me out.

Thanks in advance!

Dennis

Answer

gabrielem picture gabrielem · Dec 15, 2013

In some way the best and easy Php Framework for write API and RESTful application is

Slim Framework

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs. slimframework.com

hello world:

<?php
$app = new \Slim\Slim();
$app->get('/hello/:name', function ($name) {
    echo "Hello, $name";
});
$app->run();