Official Source Code Repository Has Moved
As of May 28, 2009, the official source code repository and bug tracking database for QueryPath is located at GitHub. FedoraHosted? has been a wonderful starting point, but we need both the advanced issue tracker and the increased flexibility that GitHub? offers.
QueryPath: Find Your Way
QueryPath is a PHP library resembling jQuerycompare. It implements much of the jQuery API, but it is oriented toward server-side programming. It can be used for parsing or generating HTML and XML (including RSS Example, SVG Example, and similar formats). The QueryPathDataBase layer makes it easy to query a database and insert the results into HTML or XML documents. A plugin architecture makes it easy to extend.
Table of Contents
- What Is QueryPath?
- Installing QueryPath
- A QueryPath Tutorial
- QPDB: The Query Path Database Layer
- QueryPath Templates
- The QueryPath List Extension
- QueryPath Extensions
QueryPath uses a chainable API (sometimes called a Fluent Interface). Following jQuery, it uses succinct and short idioms, making it easy to accomplish complex tasks in only a few lines of code.
Here's a sample of QueryPath in action:
<?php require_once 'QueryPath/QueryPath.php'; qp('./test.html')->find('title')->text('Welcome')->writeHTML(); ?>
This fragment loads the QueryPath library, and then executes a single jQuery chain. The chain opens a file, test.html, and then finds the <title/> element. The text inside of that element is then set to Welcome, and the entire document is then written to standard out (that is, it is sent to the client).
Get the source, documentation, examples, and unit tests all in one file:
See InstallQueryPath for installation instructions.
What You Need to Know
- QueryPath is written in PHP 5, and it uses the DOM library that comes standard with PHP 5. The QPDB library, an extension that adds database support, uses PDO, another standard component of PHP 5. (QueryPath will not run on PHP 4)
- QueryPath is made available under the GNU Lesser GPL (LGPL) or (at your choice) an MIT-like license. We encourage you to contribute your changes back, though, so that we can all work together to make a better library.
- QueryPath has no license fees associated with it. Just download it and use it.
You may wish to join one of the two QueryPath groups/lists:
- Support: http://groups.google.com/group/support-querypath
- Development: http://groups.google.com/group/devel-querypath
Find out more at the QueryPathCommunity page.