Zend Rest Controller for api and web together
Does anyone have experience implementing an api with Zend framework? I see it's possible to implement index, get, post, put, delete for the api, then implement new and edit actions for the web in the same controller. But is this a good idea? I want开发者_JAVA技巧 to know if this implementation has been tested enough that people don't get problems with it down the road.
I've had success using the Context Helper to give 'API' access using the same URI structure as the 'normal' site. Then API consumers just have to POST data like a normal form. Depending on the complexity of your needs, that might work for you.
Also, it should be noted that Zend provides a REST router that may be useful.
精彩评论