Better Rest Routing Support

Hi guys!

I’m a great fan of Yii over other popular frameworks, and back in Brazil I used to spread the word of Yii instead of bulky frameworks such as Symfony or Cake for general, full-stack applications (my point of view).

One of the things I really like about Yii is the easiness of using controllers, helpers, behaviors and the AR models.

However, recently I’m developing a system with separate components: Mobile app, web front-end, and browser extension. Everything would ideally be backed up by a REST service. However, I found cumbersome to work with this on Yii, since it would add a lot of work to make the RESTful routes working… Yii routing system is great for websites, but it’s boring for REST stuff - specifically, I find hard to define verbs on routes (and having equal paths for different verbs) and working with parameters that did not came from GET/POST in the controllers.

How about a better way to work with those parameters, and a more lightweight router? Maybe a different component in place of it, where we could focus on verbs and map that easily to controller actions…

Someone have already shown here Laravel and it’s REST controllers, and I’m currently using Restler for this work, although I had to find another AR and migration libs, and so on. I thought about using Yii classes, but as they are all packaged in the same place, I decided to go for standalone libs.


REST is really important.

There was a discussion a year ago:

Would this take care of the case where you can use RESTful API requests internally?

For example you have user API CREATE. But you have a specific type of user, say author, and you have author API CREATE. Would the author create method be able to internally call and use the user create method, forwarding the POST parameters?

No, no HMVC.

Is there a thread discussing HMVC somewhere? Any reason internal requests aren’t permitted? I seem to recall someone mentioning modules being able to do the same thing, but when building a mobile app that’s driven by a web based REST API, I don’t see how the API could also be used within the app itself keeping it dry.

Yes, here:

The issue you’ve mentioned makes sense.