pdoTools 3 is a set of everyday MODX Revolution 3 snippets plus a small library that keeps them fast. Queries are built with xPDO and run through PDO. Elements can live in the database or in files. MiniShop3 use it.
This branch requires MODX 3 and PHP 8.1+. For MODX 2 use pdoTools 2.x.
Documentation: docs.modx.pro/components/pdotools
From core/components/pdotools:
composer install
composer testIntegration tests need a live MODX 3 tree (CI installs 3.2.4-pl and the transport with PKG_AUTO_INSTALL=true):
export MODX_TEST_BASE=/path/to/modx/
composer test:integrationCoverage (pcov or xdebug): composer test:coverage. HTML report lands in coverage/html.
Every pdoTools snippet shares the same core:
- Database work goes through PDO. xPDO objects are created only when needed.
- Simple placeholders in chunks are preprocessed so the MODX parser only handles complex tags.
- TV parameters are sorted, prepared, processed, and output correctly.
- Chunk code can sit inline in the snippet call, in a normal chunk, or in a static file (
@FILE,@INLINE,@TEMPLATE). - Fast placeholders wrap a value in tags only when it is not empty (covers many
isempty-style cases). - A timed work log for debugging bottlenecks. Snippet logs go into a matching placeholder (
pdoResourcesLog,pdoPageLog, …).
Queries can target any tables, with joins and conditions. Pagination stays compatible with getPage via pdoPage. The package includes the Fenom template engine.
Compared with stock MODX helpers:
pdoTools::getChunk()processes placeholders faster thanmodX::getChunk().pdoTools::runSnippet()is faster and more powerful thanmodX::runSnippet().
These snippets usually run faster when you select more fields in a single query.
Classes live under ModxPro\PdoTools\ (PSR-4). The service container still accepts the aliases pdoTools and pdoFetch.
| Snippet | Role |
|---|---|
| pdoResources | Resource lists (parameter-compatible replacement for getResources) |
| pdoMenu | Menus (Wayfinder replacement) |
| pdoPage | Pagination (getPage replacement) |
| pdoCrumbs | Breadcrumbs (BreadCrumb replacement) |
| pdoUsers | Users, with role and group filters |
| pdoSitemap | Sitemap generation (GoogleSiteMap replacement) |
| pdoNeighbors | Links to neighboring resources |
| pdoField | Any resource field (getResourceField / UltimateParent replacement) |
| pdoTitle | Page title helper |
| pdoArchive | Archive listings by date |
| Class | Docs |
|---|---|
| pdoTools | ModxPro\PdoTools\CoreTools — core helpers (getChunk, runSnippet, caching, …) |
| pdoFetch | ModxPro\PdoTools\Fetch — query builder and PDO fetch layer |
| pdoParser | ModxPro\PdoTools\Parsing\Parser — parser integration (Fenom / FastField tags) |
- General properties shared by the snippets
- File elements
- Parser
- Docs: https://docs.modx.pro/components/pdotools/
- Issues: https://github.com/modx-pro/pdoTools3/issues
- MODX 2 branch: https://github.com/modx-pro/pdoTools