简体   繁体   English

可帮助您轻松将REST与JSON结合使用的PHP库/类?

[英]PHP Libraries/Classes that helped you easy using REST with JSON?

I would like to know what existing PHP libraries/classes have you used for your REST+JSON projects. 我想知道您在REST + JSON项目中使用了哪些现有的PHP库/类。

If I need to create a wrapper for social engines API such as Facebook and/or Twitter API, what existing PHP REST JSON architecture do you recommend? 如果我需要为社交引擎API(例如Facebook和/或Twitter API)创建包装器,那么您建议使用哪种现有的PHP REST JSON架构?

JSON CONSUMING DEVICE (not PHP based) <--> PHP REST SERVICE <--> SOCIAL API JSON消费设备(不基于PHP)<-> PHP REST SERVICE <-> SOCIAL API

If all you need is a RESTful client, then I don't really see why you need a framework at all. 如果您只需要一个RESTful客户端,那么我真的看不到您为什么需要一个框架。

You can use eg the curl libraries to do an HTTP request (or even plain sockets), and then json_decode & json_encode for the JSON. 您可以使用例如curl库执行HTTP请求(甚至是普通套接字),然后使用JSON的json_decodejson_encode That's it. 而已。 That's your client right there. 那就是您的客户。 REST is not more than that. REST不仅如此。

I'm sure there are wrappers around PHP's curl library that are a little bit more intuitive for the RESTful "I just want to GET/POST/PUT/DELETE some data" approach, but then again it's at most 20 lines of code to roll a class that does that yourself. 我确信PHP的curl库周围有一些包装,对于RESTful“我只想GET / POST / PUT / DELETE一些数据”方法来说,包装器要直观得多,但是最多也要滚动20行代码自己做的一堂课。

Zend Framework has a REST library available, with client and server, as well as the REST route and controller . Zend Framework具有一个可用的REST库 ,其中包括客户端和服务器,以及REST路由和控制器 It also has context switching available, so it's easy to switch output to XML, JSON, or whatever you want if you extend it. 它还提供了上下文切换功能 ,因此很容易将输出切换为XML,JSON或任何您想要扩展的内容。 There is also a Twitter service available, although I haven't tried it. 还有一个Twitter服务可用,尽管我还没有尝试过。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM