I was curious as to whether or not there exists a jQuery-style interface/library for PHP for handling HTML/XML files -- specifically using jQuery style selectors.
I\
simplexml perhaps? Its syntax is different from jquery, but it does make traversing XML really easy.
It will however not work for HTML that is not valid XML.
http://fluentdom.org/ is another alternative.
my alternative is https://github.com/gymadarasz/xparser
fast and easy to use, an example:
$x('#nav a', function($elem) {
$elem->href = '//myurl/' . $elem->href;
});
HtmlPageDom extends Symfony's DOM Crawler and adds jQuery-like DOM manipulation functions.
Doing some more hunting, I think I might've found precisely what I was looking for:
phpQuery - jQuery port to PHP
Thanks everyone for your answers, I will definitely keep them in mind for other uses.
The best one I found is https://github.com/scotteh/php-dom-wrapper
It works very similarly as jQuery, and it is fast.
I tried many libraries from other answers, but I didn't manage to port the manipulations I was doing in jQuery easily. With this one it was a breeze. I guess it will become more popular soon...