我需要一个框架来构建PHP中的REST API? [英] Do I need a framework to build a REST API in PHP?

查看:155
本文介绍了我需要一个框架来构建PHP中的REST API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是相当新的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(请纠正我,如果我错了)。我目前不使用我的web应用程序一个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 target.

BUT
但是如果你使用一个框架来管理您的API将是真正的简单。我建议你​​去一个轻量级的框架,也许你可以很容易地转换你的web应用的框架也有一个应用程序返回两个不同的东西(网络资料和放大器; API)。

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

看看 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆