Hacker News new | comments | show | ask | jobs | submit login

PHP's has mature URI parsing using several built-in functions that provide very similar functionality.

parse_url http://us.php.net/parse_url for getting URI components

parse_str http://us.php.net/parse_str for getting query string variables

These two functions take care of the vast majority of my URI parsing/creation tasks.

Of course it would be nice to have a fluent interface like URI.js via a PHP class. And the URI normalization functions.

Tnx, I knew about those, I am currently building the fronted for the Solr powered search engine (adding/removing facets from the url) and sometimes it gets pretty messy.

I was hoping there are some existing resources before I start porting this...


Funny… URI.js is more or less a port of my PHP URL class. Zend Framework has one. look at https://gist.github.com/1499238 to get you started. (Not a chainable API and not as powerful as URI.js either). The path resolving can be taken from the code I wrote for Smarty a couple of months ago: http://code.google.com/p/smarty-php/source/browse/trunk/dist... - lemme know if/when/how you're done… interested in using the PHP version myself ;)


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact