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 mob
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.
REST is more of a design ideology than a language framework, so NO you don't NEED to use any framework. However there is no advantage in reinventing the wheel (Sure some disadvantages are there like security, structure etc.).
If you want to avoid mayhem of MVC (which is not required specification of a REST architecture) you can use any PHP mico-framework (Slim, Lumen etc) they are really quick to learn and implement and allow PHP developer to write route based app (similar to those of MEAN and Express) saving a lot in time.
Most of these frameworks comes with an MVC as well but if you don't want to give a CMS for the API, MR (Model-Routes) is good enough (and practically the best) for all REST needs.
Since the dawn of angular like frameworks which allows your website to communicate with sever like any other API easily, I think even the CMS should access the API like any other app just with elevated rights or specific end-poin
NO, YOU DON'T NEED ANY FRAMEWORK FOR PHP BACKEND.
If you are using php as backend then you don't need to use any resetAPI framework. Just create you own php files and generate JSON output for each response.
You must generate JSON output. That is enough. Benefits:- If you use own login to generate Json output then it will be tremendous light speed (based on your logic). If you use any framework then the performance issues will occure.
It will be better if you can design your own mini framework to do specific site's work.
Thanks
Not necessarily, you don't really need a framework for anything! The framework is made just to provide you with tools to help building your projects faster. These days in most cases it is smarter to use a framework, cause who likes to reinvent the wheel!
Since you are a PHP developer and the best answer suggests to take a look Laravel, I would also suggest that you to take a look at Apiato (apiato.io), this is a PHP API framework built on top of Laravel. It lets you create your API way faster than starting with a vanilla Laravel, as it provides you with tens of features that you already need for every API.
The World is very very big, so, no one can do all things alone. Someone will help someone (who do something new) do something old. This is reason, libray and FW exist in our IT World.
In production/live environment, anything is very more complex than we think. Until a day in future, we will need to build so many thing for our project, and we will see that those things has been built by FW completely before.
Although just a RESTful Server, with pure PHP, we need resolve problems with: URI routing, parsing/cleaning request data, data access, dependency management, generating responses, bla bla bla...
I recommend using Slim or Phalcon (Micro App). Slim is a easy and quickly method, but Phalcon is a effective and high performing method.
There are also tools that create a REST api from the DB without the need for extra code.
If you are using Postgres there is the excellent program postgREST that
serves a fully RESTful API from any existing PostgreSQL database. It provides a cleaner, more standards-compliant, faster API than you are likely to write from scratch.