Is there an equivalent JQuery class of DOM manipulator / CSS selector in PHP?

I know that I can use DOMDocument and DOMXPath to manage XML files. But I really like jQuery, and it would be great if there was something similar to jQuery in the PHP world, which I could use to manipulate the DOM from the parallel side.

NOTE: I am only interested in how JQuery selects and manipulates the DOM, not all other parts of JQuery (I think you can only say pop and Sizzle parts).


Update:
There seems to be an equivalent for selector functions, but as I understand it, I have to stick with DOMDocument.
+2
jquery php css-selectors sizzle dom-manipulation
source share
4 answers

Well, excluding all the specific JavaScript things you left out with the CSS selector mechanism:

http://framework.zend.com/manual/en/zend.dom.query.html

Enjoy :)

+3
source share

You can use phpQuery

It describes itself as follows: phpQuery is a PHP5-server, one-piece, CSS3 selector Document Object Model (DOM) API based on the jQuery JavaScript library.

+4
source share

Yes, HtmlPageDom is written just for what you ask.

+2
source share

@retro: what he asks for is a sizzle-like library that works using PHP as a language instead of javascript, what you said about β€œno change to write this” is wrong, it's just code, you can write it as you wish.

However, the problem is that javascript running inside the browser gives you +1 up access to the DOM system, which can help you in creating a large number of dom / html nodes automatically, without having to do them yourself.

in php, the DOM just hurts, jquery happily hides it, and since javascript works differently than PHP, it can do it without much effort, however PHP does not have access to the browser DOM and has a different way of working, it is much more painful.

This does not mean that it is impossible, because it is simple, that it is not so simple, and sometimes another, when there is no clear reason why, I believe that the PHP DOM internally uses libXML or something similar, and provides too much part of this library is inside, so PHP gets clogged with the semantics of C library

I think you should look at phpQuery (https://github.com/TobiaszCudnik/phpquery) or even better in the active development of QueryPath (http://querypath.org).

however, do not expect them to be as light as the javascript javascript library, because it is not, unfortunately .....

+1
source share

All Articles