Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
QueryPath is a PHP library for manipulating XML and HTML. It is designed to work not only with local files, but also with web services and database resources.

This branch is 1 commit ahead, 233 commits behind technosophos:master

Failed to load latest commit information.
bin Initial add of some additional PEAR package tools.
examples corrected line 38 from li -> li_ele from foreach
phar Fixed a bug in the phar builder (Issue #43).
src tplArrayR bug fixed
test Updated unit tests, re-fixed #63.
tutorials Addressed bug in my implementation of :contains(), added contains-exa…
.gitignore Updated gitignore.
API Added support for extra argument on xpath(). Thanks, Xavier Prudhomme
COPYING-LGPL.txt New Phing-based build system.
COPYING-MIT.txt Updated license, INSTALL, and README.
LGPL-2.1.txt Added licensing files. Updated README to point to 3.x.
RELEASE Issue #59: Added release notes, added Steven to credits.
build.xml Updated build.xml to point to current pyrus.
composer.json Change to SPDX License Identifier (LGPL-2.1+ or MIT) for composer
config.doxy Fixed version number in doxy config.
package.xml Fixed build system for template-based PEAR builds with Pyrus.
package_compatible.xml Fixed a bug in the phar builder (Issue #43).
pear-summary.txt Added a file that contains PEAR summary text.

QueryPath: Find your way.

New development is happening on the 3.x branch.

Authors: Matt Butcher (lead), Emily Brand, and others

Website | API Docs | VCS and Issue Tracking | Support List | Developer List | Pear channel |

This package is licensed under the GNU LGPL 2.1 (COPYING-LGPL.txt) or, at your choice, an MIT-style license (COPYING-MIT.txt). The licenses should have been distributed with this library.

QueryPath Installers

The following packages of QueryPath are available:

  • PEAR package (pear install querypath/QueryPath): Installs the library and documentation.
  • Download from the GitHub Tags page.
  • Composer: Add this to the 'require' section of your composer.json:
  "require": {
    "querypath/QueryPath": ">=2.0.0"

Or if you prefer PEAR:

$ pear channel-discover
$ pear install querypath/QueryPath

Downloads (for manual installation)

  • Phar (QueryPath-VERSION.phar): This is a Phar package which can be used as-is. Its size has been minimized by stripping comments. It is designed for direct inclusion in PHP 5.3 applications.
  • Minimal (QueryPath-VERSION-minimal.tgz): This contains only the QueryPath library, with no documentation or additional build environment. It is designed for production systems.
  • Full (QueryPath-VERSION.tgz): This contains QueryPath, its unit tests, its documentation, examples, and all supporting material. If you are starting with QueryPath, this might be the best package.
  • Docs (QueryPath-VERSION-docs.tgz): This package contains only the documentation for QueryPath. Generally, this is useful to install as a complement to the minimal package.
  • Git repository clone: You can always clone this repository and work from that code.

If in doubt, you probably want the PEAR version or the Full package.

Including QueryPath

If you installed QueryPath as a PEAR package, use it like this:

require 'QueryPath/QueryPath.php';

From the Full Install:

require 'QueryPath/src/QueryPath/QueryPath.php';

With the Phar archive, you can include QueryPath like this:

require 'QueryPath.phar';

Unfortunately, in the 2.1 branch of QueryPath, the Composer include is:

require 'vendor/querypath/QueryPath/src/QueryPath/QueryPath.php';

The next major release of QueryPath will support Composer autoloading.

From there, the main functions you will want to use are qp() and htmlqp(). Start with the API docs.

Something went wrong with that request. Please try again.