Do I need a framework to build a REST API in PHP?

SHORT ANSWER No, you don't need a framework to achieve your goal.

BUT it will be really easier if you use a framework to manage your API. I suggest you to go for a lightweight framework and maybe you can convert easily your webapp to the framework too, having one "app" to return two different "things" (web stuff & API).

Take a look at Laravel, Laravel 4 based REST API or a list of popular php rest api frameworks that can be used to build one.


You certainly don't need any kind of framework to build a PHP REST API. REST is nothing more than a protocol convention built on top of HTTP. Since PHP can obviously handle HTTP requests, it has everything you need to build RESTful API's.

The whole point of frameworks is to handle common tasks and things that are otherwise tedious. REST API's are commonly built with PHP, so a plethora of frameworks exist. Personally, I would use a lightweight framework like slim simply to handle things like URI routing, parsing/cleaning request data, and generating responses.


No you do not need a framework to build a REST API, but it is highly recommended, as a well built framework can take care of things that can be very difficult and complicated otherwise, namely session authentications and caching and well separated architecture. Reinventing the wheel only gets you so far.

I'm a developer of Wave Framework which was developed keeping in mind an API-centric design (read more here). I encourage you to take a look into this framework and see if it might be something that could help you. It has a small group of developers, but it is slowly gaining recognition.

I encourage you to take a look at that and if it might fill your needs.