Xao is built around a single unifying architectural thesis: every request constructs one well-formed XML conglomeration document by aggregating heterogeneous data sources into a single DOM tree, then transforms that tree into the final representation via XSLT 3.0.
Relational DB (PDO / DbToXml) ──┐
Static / File XML Fragments ───┼──▶ DomDoc / AppDoc ──▶ XsltDriverInterface (XSLT 3.0) ──▶ HTML / XML / RSS / JSON
External Feeds & HTTP APIs ───┤ (Conglomeration) • PhcNativeXsltDriver (default, built-in xee-xslt)
Domain DomDoc Objects ───┤ • SaxonHttpDriver (HTTP / distributed)
Markdown to XML (CommonMark) ───┘ • ClientSideXslDriver (fallback)
Why XML Conglomeration Works
One data boundary, many outputs: Because PHP produces a clean XML tree rather than concatenating HTML strings, the exact same
DomDoccan render HTML5, Atom/RSS, SVG, print-ready specs, or raw XML without changing PHP controllers.True separation of concerns: PHP handles authentication, database queries, slug validation, Markdown parsing, and error normalization. XSLT 3.0 handles layout, grouping, navigation highlights, and accessibility landmarks.
Inspectable page state: During development or via dedicated endpoints like
/xml/{slug}in XaoDocs, the entire request model is inspectable as a single XML artifact.Stateless worker safety:
AppDocandDocsApphold zero mutable per-request static state, allowingphc servemode = "worker"to reuse booted PHP workers across thousands of requests with zero state leakage.
Core Building Blocks
| Component | Responsibility |
|---|---|
Xao\XaoRoot | Structured, inspectable error tracking (addError, addException, hasErrors) without silent failures |
Xao\DomDoc | Strict PHP 8 DOMDocument / DOMXPath wrapper for tree construction, XML/file consumption, namespace-aware nodes, and <error> generation |
Xao\DomFactory | Safe entrypoints (fromXml, fromFile, fromRoot) enforcing XXE/DOCTYPE rejection and realpath() containment |
Xao\DbToXml | Serializes PDO queries, PDOStatement, and iterables into clean <result><row> XML trees |
Xao\AppDoc | Stateless front controller pairing routes, gated debug output (?xao:XML=1), and XSLT 3.0 drivers |
Xao\Xslt\Transformer | Enforces stylesheet-root realpath() containment and delegates rendering to XsltDriverInterface |
Explicit Non-Goals
Xao intentionally avoids competing with full-stack ecosystems like Laravel or Symfony:
No backwards compatibility with PHP 4
domxml, Sablotronxslt_*, or PEARDB.No Composer runtime dependency tree in core
src/.No unsafe C
libxsltFFI bindings inside PHC (#![forbid(unsafe_code)]).