I see a lot of php libraries that can parse html. A good example is QueryPath , which mimics jQuery Api.
However, I am looking for phtml analysis. Thus, the library not only parses the DOM well, but also parses the php processing instructions well. for example, the php or PDOM document object model.
A document like this:
<?php require 'NameFinder.php'; $title = 'Wave Hello'; $name = getName(); ?><html> <head> <title><?php echo $title ?></title> </head> <body> <h1>Hello <?php echo $name ?></h1> <p>Blah Blah Blah</p> </body>
I would like to use this php library to read things like:
- internal html DOM node found using xpath or css selector.
as well as offering things like:
- list of php functions / methods called in script
- php variable values
- pages required by this page
- list of php variables used before line 5
- list of php variables used before the 1st pair of body element
I could spend some time putting it together, borrowing code from things like phpdocumentor and Zend Framework Reflection , using the built-in Api DOM, introspection and string manipulation, etc.
But if there is some * phtmlQuery library that can do such things, then it will be convenient.
source share