我对 PHP 相当陌生(大约 8 个月).我正在构建一个 Web 应用程序,它几乎已准备好进行测试.我现在才开始考虑制作该应用程序的移动版本需要做什么.
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.
据我了解,我应该构建一个 REST API(如果我错了,请纠正我).我目前没有为我的网络应用程序使用 PHP 框架.我可以做?
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?
我现在应该开始使用框架以便更轻松地实现我的 API 吗?或者我可以在没有任何框架的情况下构建我的 API?
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?
简短回答不,你不需要一个框架来实现你的目标.
SHORT ANSWER No, you don't need a framework to achieve your goal.
但是如果您使用框架来管理您的 API,这将变得非常容易.我建议你选择一个轻量级的框架,也许你也可以轻松地将你的 web 应用程序转换为框架,让一个应用程序"返回两个不同的事物"(网络内容和 API).
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).
看看 Laravel, 基于 Laravel 4 的 REST API 或流行的列表 php rest 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.
这篇关于我是否需要一个框架来在 PHP 中构建 REST API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!