4 ms·
PHP's has mature URI parsing using several built-in functions that provide very similar functionality. parse_url http://us.php.net/parse_url http://us.php.net/
by pygorex 15y ago
PHP's has mature URI parsing using several built-in functions that provide very similar functionality.
parse_url http://us.php.net/parse_url http://us.php.net/parse_url for getting URI components
parse_str http://us.php.net/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.
- gog 15y agoTnx, 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...
- rodneyrehm 15y agoFunny… URI.js is more or less a port of my PHP URL class. Zend Framework has one. look at https://gist.github.com/1499238 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/distribution/libs/sysplugins/smarty_resource.php#182 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 ;)