1

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!

2
  • 1
    While the Symfony component libraries (such as HttpFoundation) can be used standalone, Symfony bundles are targeted specifically for Symfony framework based applications. Components and bundles are two different concepts. I suppose you could try to dig into the code but it's almost all Symfony specific wiring type code. There are some Symfony components such as the Serializer that might help. Commented Dec 2, 2015 at 20:39
  • Ah, it looks I had inaccurately conflated the terms 'component' and 'bundle'. Thank you for the clarification! Commented Dec 3, 2015 at 17:45

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.