NOTICE: I am not referring to cUrl but a Url object
Hello ppl,
Do you think it would be nice to introduce a Url object in the yii 2.0. This would be used internally in CUrlManager and CHttpRequest but it would hold the logic and functionality around urls like:
Creating a PATH or GET url ( currently in CUrlManager )
Be able to getRequestUri from a url ( part of the CHttpRequest ), so people would be able to handle url with common Yii functions.
Please let me know what you think about it. It’s just a draft thought.
Dunno, something’s telling me that weren’t such a good idea. I clearly see how you got there, but it doesn’t feel right.
I’m currently experimenting with phpnode’s work on a CHttpResponse class and had about the same idea. I left the URLs as strings eventualy. It looked a lot like bloat to me. And … yeah, well, what phpnode said: There’s always parse_url().
Again, It’s not about parsing url. It’s about generating url as well.
I want to consume an api that has PATH format instead of GET. So I have ‘http://some.api.com/’ and an array like array(‘user’=>1) where 1 the id of the user. How can I create it ? Of course there is a php way but wouldn’t be nice to be able to have a yii premade infastructure for this stuff?
I would really did not want to mix up this 2, this is why I mentioned creating this object to handle the urls and the urlmanager will use this object internally for the application urls.
Eye-catching from the API: Support for port, userinfo (both missing in horde_url) and a whole lot seems to be about encoding.
For a recent project, I searched a way to transform a relative URL into an absolute one. Think this would be another candidate for such a class. In the end, I used this: http://sourceforge.net/projects/absoluteurl/