Download the PHP package arthurkushman/query-path without Composer
On this page you can find all versions of the php package arthurkushman/query-path. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arthurkushman/query-path
More information about arthurkushman/query-path
Files in arthurkushman/query-path
Package query-path
Short Description HTML/XML querying (CSS 4 or XPath) and processing (like jQuery)
License MIT
Homepage https://github.com/arthurkushman/querypath
Informations about the package query-path
QueryPath: Find the better way
At A Glance
QueryPath is a jQuery-like library for working with XML and HTML documents in PHP. It now contains support for HTML5 via the HTML5-PHP project.
Why this lib was forked and recoded
- Legacy code (repo was left for > 3 years) didn't allow to support new features of PHP>=7.1
- A lot of DeaDBeaF code like: unused params, unused local variables etc
- A lot of needless flow structures
- DRY/KISS/SOLID rules were thrown away when it was developed
- Minor bugs and fragile functionality
Installation
Gettings Started
Assuming you have successfully installed QueryPath via Composer, you can parse documents like this:
But the real power comes from chaining. Check out the example below.
Example Usage
Say we have a document like this:
And say that the above is stored in the variable $xml
. Now
we can use QueryPath like this:
(This example is in examples/at-a-glance.php
.)
With over 60 functions and robust support for chaining, you can accomplish sophisticated XML and HTML processing using QueryPath.
From there, the main functions you will want to use are qp()
(alias of QueryPath::with()
) and htmlqp()
(alias of
QueryPath::withHTML()
).
QueryPath Format Extension
format()
A quick example:
OUTPUT:
formatAttr()
A quick example:
OUTPUT: