Progger Progger - 1 month ago 11
PHP Question

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

I am fairly new to PHP (about 8 months). I am building a web app, which is almost ready for beta. I am only now starting to think about what I would need to do to make a mobile version of the app.

As I understand, I should be building a REST API (please correct me if I'm wrong). I am currently NOT using a PHP framework for my web app. Should I be?

Should I now begin using a framework so that I could more easily implement my API? Or can I build my API without any framework at all?

Answer

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

BUT 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.