简体   繁体   中英

Using the RESTful API package “FOSRestBundle” outside of a Symfony2 application

I'm supporting a legacy ZF1 application which now needs to expose a RESTful API to the outside world. I'd like to take advantage of a modern PHP package for some of the API's boilerplate functionality (authentication, request parsing, response generation in multiple data formats, etc.) rather than coding it all from scratch, or using ZF1's poorly-documented REST library.

Packagist suggests that FOSRestBundle is the most popular PHP component for developing RESTful API servers. And as far as I understand it, Symfony2 components are flexible enough to be used outside the context of a full Symfony2 framework-based application.

Has anyone has successfully used this particular package outside of a full Symfony2 project? If so, was it painless or were there some significant challenges that you had to overcome? I can see URL routing, and my lack of general Symfony2 knowledge, as potential pain points.

Any advice or suggestions would be greatly appreciated. Thanks!

I'm afraid you can't do it without hacking a lot.

I would recommend you to go for APIgility, there are some tutorials where you can the integration with ZF1. You'll also get the advantages of content negotiation, auth, documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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