<?xml version="1.0" encoding="UTF-8"?>
<xao-docs>
  <site name="XaoDocs" product="Xao" version="1.0.0-dev" homepage="https://xao.ndx.au" repo="https://github.com/ndx-au/Xao" examples-repo="https://github.com/ndx-au/xao-example-apps"/>
  <request slug="getting-started" theme="atlas" path="/xml/getting-started" xml-url="/xml/getting-started"/>
  <themes>
    <theme id="atlas" name="Atlas" tagline="Three-column reference desk with persistent sidebar and sticky page outline" audience="API and framework developers browsing across sections" structure="3-column grid: left navigation sidebar, center article, right on-this-page outline" css="/assets/atlas.css" active="true"/>
    <theme id="folio" name="Folio" tagline="Editorial journal spread with XPath-grouped numbered chapters and collapsible library" audience="Architects and evaluators reading long-form conceptual chapters" structure="Editorial cover header, collapsible library drawer, and sibling-grouped numbered chapter sections" css="/assets/folio.css" active="false"/>
    <theme id="console" name="Console" tagline="Operations dashboard with telemetry strip and collapsible H2 module accordions" audience="SREs, operators, and runtime engineers scanning sections quickly" structure="Command header, telemetry bar, compact nav rail, and expandable &lt;details&gt; module accordions" css="/assets/console.css" active="false"/>
    <theme id="reader" name="Reader (A11y)" tagline="WCAG AAA single-column linear reader with upfront summary, numbered TOC, and zero JS" audience="Screen reader users, keyboard-only navigation, and low-vision / cognitive accessibility" structure="Multi-landmark skip links, upfront document summary, inline numbered TOC, figure-wrapped code blocks, directory after article, zero JS" css="/assets/reader.css" active="false"/>
    <theme id="handbook" name="Handbook" tagline="Single-column print-ready technical specification sheet with metadata ledger" audience="Technical reviewers, auditors, and print/PDF export workflows" structure="Single-column specification document with &lt;dl&gt; metadata ledger, numbered outline, and print stylesheet" css="/assets/handbook.css" active="false"/>
  </themes>
  <navigation>
    <section name="Start Here">
      <item slug="index" title="Xao Documentation" description="XML Application Objects for PHP 8 and PHC — zero-dependency XML content aggregation and XSLT 3.0 presentation." order="1" active="false"/>
      <item slug="getting-started" title="Getting Started" description="Set up PHC, autoload Xao with zero Composer packages, transform your first DomDoc with XSLT 3.0, and run phc serve." order="2" active="true"/>
    </section>
    <section name="Core Concepts">
      <item slug="architecture" title="Architecture &amp; XML Aggregation" description="How Xao builds a unified XML conglomeration document from databases, Markdown, and domain objects before delegating presentation to XSLT 3.0." order="3" active="false"/>
      <item slug="xslt-themes" title="XSLT 3.0 Themes vs CSS Skins" description="Why XSLT themes are structurally and semantically richer than CSS-only themes — including accessibility-first DOM transformations." order="4" active="false"/>
    </section>
    <section name="Framework Reference">
      <item slug="core-api" title="Core API Reference" description="Reference for Xao\\Runtime, Xao\\XaoRoot, Xao\\DomDoc, Xao\\DomFactory, Xao\\AppDoc, Xao\\Http\\Response, and Xao\\Exceptions." order="5" active="false"/>
      <item slug="database-aggregation" title="Database Aggregation (DbToXml)" description="Convert PDO queries, PDOStatement results, and PHP iterables directly into structured DomDoc XML fragments under PHC." order="6" active="false"/>
      <item slug="markdown-aggregation" title="Markdown Aggregation" description="Convert CommonMark and GFM into CommonMark XML 1.0 natively in PHC via comrak and graft it into Xao DomDoc trees." order="7" active="false"/>
      <item slug="xslt-drivers" title="XSLT 3.0 Drivers" description="Pluggable XsltDriverInterface strategies: PhcNativeXsltDriver (default in-process), SaxonHttpDriver (HTTP/distributed), and ClientSideXslDriver." order="8" active="false"/>
    </section>
    <section name="Operations &amp; Runtime">
      <item slug="phc-runtime" title="PHC Runtime &amp; Compatibility" description="Running Xao on PHC in isolate and worker modes, sandbox defaults, worker-safe autoloading, and P00–P05 compatibility findings." order="9" active="false"/>
      <item slug="security" title="Security Model" description="XXE rejection, realpath containment, strict slug allowlists, CSRF guards, gated debug output, and PHC sandbox enforcement." order="10" active="false"/>
    </section>
    <section name="Examples &amp; Design">
      <item slug="reference-apps" title="Reference Applications" description="Comparing Xao's built-in SQLite PDO catalog reference app with XaoDocs, the flat-file Markdown multi-theme CMS." order="11" active="false"/>
      <item slug="adr-0001-phc-xee-xslt" title="ADR 0001 &amp; Roadmap" description="Architecture Decision Record for pure-Rust xee-xslt in PHC plus the Xao v1.0.0 milestone and phase roadmap (M0–M3, P00–P06)." order="12" active="false"/>
    </section>
  </navigation>
  <page slug="getting-started" title="Getting Started" description="Set up PHC, autoload Xao with zero Composer packages, transform your first DomDoc with XSLT 3.0, and run phc serve." section="Start Here" audience="Developers new to Xao and PHC" status="stable" words="183" reading-minutes="1" source-file="content/getting-started.md">
    <tags>
      <tag>quickstart</tag>
      <tag>phc</tag>
      <tag>autoload</tag>
      <tag>xslt3</tag>
    </tags>
    <neighbors>
      <prev slug="index" title="Xao Documentation"/>
      <next slug="architecture" title="Architecture &amp; XML Aggregation"/>
    </neighbors>
    <body>
      <document xmlns="http://commonmark.org/xml/1.0">
        <heading level="1">
          <text xml:space="preserve">Getting Started</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">Xao requires </text>
          <strong>
            <text xml:space="preserve">zero Composer runtime dependencies</text>
          </strong>
          <text xml:space="preserve">. Everything runs directly on the </text>
          <strong>
            <text xml:space="preserve">PHC</text>
          </strong>
          <text xml:space="preserve"> Rust application server (</text>
          <code xml:space="preserve">phc</code>
          <text xml:space="preserve"> default build with built-in </text>
          <code xml:space="preserve">xsl3</code>
          <text xml:space="preserve"> and </text>
          <code xml:space="preserve">markdown-xml</code>
          <text xml:space="preserve"> extensions) or standard PHP 8.4+.</text>
        </paragraph>
        <heading level="2">
          <text xml:space="preserve">Prerequisites</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">Verify that your </text>
          <code xml:space="preserve">phc</code>
          <text xml:space="preserve"> binary includes the default-on </text>
          <code xml:space="preserve">xsl</code>
          <text xml:space="preserve"> and </text>
          <code xml:space="preserve">markdown-xml</code>
          <text xml:space="preserve"> features:</text>
        </paragraph>
        <code_block info="bash" xml:space="preserve">phc -m
phc run -r 'var_dump(extension_loaded("xsl"), function_exists("phc_markdown_to_xml"));'
</code_block>
        <paragraph>
          <text xml:space="preserve">Both checks should return </text>
          <code xml:space="preserve">bool(true)</code>
          <text xml:space="preserve">.</text>
        </paragraph>
        <heading level="2">
          <text xml:space="preserve">Autoloading Xao</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">Include </text>
          <code xml:space="preserve">src/autoload.php</code>
          <text xml:space="preserve"> once at the top of your entrypoint (or register it in </text>
          <code xml:space="preserve">phc.toml</code>
          <text xml:space="preserve"> under </text>
          <code xml:space="preserve">[worker] bootstrap</code>
          <text xml:space="preserve">):</text>
        </paragraph>
        <code_block info="php" xml:space="preserve">&lt;?php

declare(strict_types=1);

require_once __DIR__ . '/src/autoload.php';

use Xao\DomDoc;
use Xao\Xslt\Transformer;

$doc = new DomDoc('catalog');
$doc-&gt;ndAppendToRoot('item', 'Xao', ['slug' =&gt; 'xao']);

$transformer = Transformer::createDefault(__DIR__ . '/stylesheets');
echo $transformer-&gt;transform($doc, 'catalog.xsl');
</code_block>
        <paragraph>
          <code xml:space="preserve">Transformer::createDefault()</code>
          <text xml:space="preserve"> inspects the runtime environment and automatically selects:</text>
        </paragraph>
        <list type="ordered" start="1" delim="period" tight="true">
          <item>
            <paragraph>
              <text xml:space="preserve">Explicit override via </text>
              <code xml:space="preserve">$forcedDriver</code>
              <text xml:space="preserve"> or </text>
              <code xml:space="preserve">XAO_XSLT_DRIVER</code>
              <text xml:space="preserve"> (</text>
              <code xml:space="preserve">'native'</code>
              <text xml:space="preserve">, </text>
              <code xml:space="preserve">'saxon'</code>
              <text xml:space="preserve">, or </text>
              <code xml:space="preserve">'client'</code>
              <text xml:space="preserve">).</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <code xml:space="preserve">PhcNativeXsltDriver</code>
              <text xml:space="preserve"> when </text>
              <code xml:space="preserve">extension_loaded('xsl')</code>
              <text xml:space="preserve"> is true (default in PHC).</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <code xml:space="preserve">SaxonHttpDriver</code>
              <text xml:space="preserve"> when a sidecar URL is supplied.</text>
            </paragraph>
          </item>
          <item>
            <paragraph>
              <code xml:space="preserve">ClientSideXslDriver</code>
              <text xml:space="preserve"> as a zero-infra fallback.</text>
            </paragraph>
          </item>
        </list>
        <heading level="2">
          <text xml:space="preserve">Running Under </text>
          <code xml:space="preserve">phc serve</code>
        </heading>
        <paragraph>
          <text xml:space="preserve">Place a </text>
          <code xml:space="preserve">phc.toml</code>
          <text xml:space="preserve"> file at your project root:</text>
        </paragraph>
        <code_block info="toml" xml:space="preserve">[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"
</code_block>
        <paragraph>
          <text xml:space="preserve">Start the server in either isolate mode or persistent worker mode:</text>
        </paragraph>
        <code_block info="bash" xml:space="preserve">phc serve phc.toml
</code_block>
        <paragraph>
          <text xml:space="preserve">Notice </text>
          <code xml:space="preserve">allow_network = false</code>
          <text xml:space="preserve"> works out of the box because </text>
          <code xml:space="preserve">PhcNativeXsltDriver</code>
          <text xml:space="preserve"> runs XSLT 3.0 completely in-process with no external sidecar.</text>
        </paragraph>
        <heading level="2">
          <text xml:space="preserve">Running Xao's Own Test &amp; Parity Suites</text>
        </heading>
        <paragraph>
          <text xml:space="preserve">From the </text>
          <code xml:space="preserve">Xao</code>
          <text xml:space="preserve"> repository root:</text>
        </paragraph>
        <code_block info="bash" xml:space="preserve">./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
</code_block>
      </document>
    </body>
  </page>
</xao-docs>
