Building A REST API Framework For Cake

Can we have a first class version of CakePHP framework solely dedicated to REST API development. Now, every mobile project needs an API and an API needs lots of things those are normally not necessary for a regular web framework. I know that cake is full stack framework and using cake for various API projects for last 4 years, but most of the time programmers find the documentation and simplicity in other mini / micro framework as straight path for them to start with.

Can we start a project that will cover API Development, API Documentations, Versioning, all as a simple CakePHP like ready to start framework and can be named as CakeAPI or something. Sometime, API framework dictates the parent framework for the entire project even if it’s a super large scale project. I believe this will make CakePHP even more popular across all languages and frameworks. (Currently this popularity is being enjoyed by Node.JS and Python Flask)

You can already do this using the CRUD plugin and this tutorial.

There is no need for that. CakePHP is already super easy to use as RESTful backend. Even without any plugin.

Actually you basically get REST for free by just enabling the RESTful routing and using serialization.

If you need versioning, which is in fact just a piece of the URL, use routing and pass the first part of the route as versions. So mapp your /v1/foo/bar /v1/ in the router config to appear as ‘version’ in your request object.

2 Likes

Thank you guys, I know REST is super easy with cake, as I’m using cake actively since 2008. I appreciate your suggestions. Actually I was referring to something like strongloop’s loopback like platform for APIs and Amazon’s API gateway documentation like system. Does this make any sense?

I’m pretty new to REST APIs in general with cakephp and I was trying to look for plugin where SYMFONY and cakephp work together. After reading your post I might change my mind and rather stick to cakephp Api.