Yii Framework Forum: Better Rest Routing Support - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Better Rest Routing Support Creating REST services in Yii is quite boring... how about improving?

#1 User is offline   igorsantos07 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 17
  • Joined: 29-May 10
  • Location:Rio de Janeiro, Brazil

Posted 28 May 2013 - 01:12 AM

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.
3

#2 User is offline   yiim 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 28-June 12
  • Location:Germany

Posted 28 May 2013 - 06:11 AM

+1

REST is really important.

There was a discussion a year ago: http://www.yiiframew...er-and-routing/
0

#3 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,390
  • Joined: 17-January 09
  • Location:Russia

Posted 28 May 2013 - 08:02 AM

https://github.com/y...yii2/issues/303
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#4 User is offline   phazei 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 20-July 09

Posted 28 May 2013 - 06:11 PM

View Postsamdark, on 28 May 2013 - 08:02 AM, said:



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?
0

#5 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,390
  • Joined: 17-January 09
  • Location:Russia

Posted 01 June 2013 - 04:14 AM

No, no HMVC.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#6 User is offline   phazei 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 20-July 09

Posted 20 June 2013 - 04:31 PM

View Postsamdark, on 01 June 2013 - 04:14 AM, said:

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.



0

#7 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,390
  • Joined: 17-January 09
  • Location:Russia

Posted 21 June 2013 - 04:54 AM

Yes, here: http://www.yiiframew...hmvc-for-yii20/

The issue you've mentioned makes sense.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users