Getting Started
Set up PHC, autoload Xao with zero Composer packages, transform your first DomDoc with XSLT 3.0, and run phc serve.
Xao requires zero Composer runtime dependencies. Everything runs directly on the PHC Rust application server (phc default build with built-in xsl3 and markdown-xml extensions) or standard PHP 8.4+.
Prerequisites
Verify that your phc binary includes the default-on xsl and markdown-xml features:
phc -m
phc run -r 'var_dump(extension_loaded("xsl"), function_exists("phc_markdown_to_xml"));'
Both checks should return bool(true).
Autoloading Xao
Include src/autoload.php once at the top of your entrypoint (or register it in phc.toml under [worker] bootstrap):
<?php
declare(strict_types=1);
require_once __DIR__ . '/src/autoload.php';
use Xao\DomDoc;
use Xao\Xslt\Transformer;
$doc = new DomDoc('catalog');
$doc->ndAppendToRoot('item', 'Xao', ['slug' => 'xao']);
$transformer = Transformer::createDefault(__DIR__ . '/stylesheets');
echo $transformer->transform($doc, 'catalog.xsl');
Transformer::createDefault() inspects the runtime environment and automatically selects:
Explicit override via
$forcedDriverorXAO_XSLT_DRIVER('native','saxon', or'client').PhcNativeXsltDriverwhenextension_loaded('xsl')is true (default in PHC).SaxonHttpDriverwhen a sidecar URL is supplied.ClientSideXslDriveras a zero-infra fallback.
Running Under phc serve
Place a phc.toml file at your project root:
[server]
listen = "127.0.0.1:8080"
document_root = "public"
front_controller = "index.php"
mode = "isolate"
workers = 2
queue = 16
[sandbox]
allowed_roots = ["public", "src", "stylesheets", "data"]
allow_network = false
allow_file_databases = true
[worker]
bootstrap = "src/autoload.php"
[ini]
display_errors = "0"
Start the server in either isolate mode or persistent worker mode:
phc serve phc.toml
Notice allow_network = false works out of the box because PhcNativeXsltDriver runs XSLT 3.0 completely in-process with no external sidecar.
Running Xao's Own Test & Parity Suites
From the Xao repository root:
./scripts/test.sh # phc check + 12 PHP 8.4 vs PHC parity unit tests
./scripts/smoke-serve.sh # live phc serve HTTP smoke checks (isolate + worker)
bash scripts/ci.sh # php -l + unit tests + Markdown relative-link check