All framework classes under src/ declare strict_types=1, require zero Composer packages, and pass phc check plus PHP 8.4 parity tests.
Xao\Runtime
Source: src/Runtime.php
public const VERSION = '1.0.0-dev'(targetingv1.0.0)public const NAME = 'Xao'public static function health(): array— returns['framework' => string, 'version' => string, 'status' => string].
Xao\XaoRoot
Source: src/XaoRoot.php
Base class providing structured, inspectable error tracking without silent failures:
addError(string $message, string $errorCode = 'XAO_ERROR', array $context = []): voidaddException(XaoException $exception): voidhasErrors(): boolgetErrors(): arraygetLastError(): ?arrayclearErrors(): voidthrowError(string $message, string $errorCode = 'XAO_ERROR', array $context = []): void
Xao\DomDoc (extends XaoRoot)
Source: src/DomDoc.php
Core XML Application Object wrapping DOMDocument and DOMXPath:
__construct(string|DOMDocument $root = 'root', string $version = '1.0', string $encoding = 'UTF-8')getDocument(): DOMDocument/getRoot(): DOMNodetoXml(bool $formatOutput = false): string/xmlGetDoc(bool $formatOutput = false): stringndAppendToNode(DOMNode $target, string $name, ?string $value = null, array $attributes = []): DOMElementndAppendToRoot(string $name, ?string $value = null, array $attributes = []): DOMElementndConsumeNode(DOMNode $node, ?DOMNode $target = null): DOMNodendConsumeDoc(DomDoc $source, ?DOMNode $target = null): DOMElementndConsumeXml(string $xml, ?DOMNode $target = null): DOMElementndConsumeFile(string $filePath, ?DOMNode $target = null, ?string $baseDir = null): DOMElementndAppendToNodeNS(DOMNode $parent, string $namespaceUri, string $qualifiedName, ?string $text = null, array $attributes = []): DOMElementndAppendToRootNS(string $namespaceUri, string $qualifiedName, ?string $text = null, array $attributes = []): DOMElementarrGetElementsByTagNameNS(string $namespaceUri, string $localName): arrayndImportNode(DOMNode $node, bool $deep = true, ?DOMNode $target = null): DOMNodetoCanonicalXml(bool $exclusive = false, bool $withComments = false): stringxpath(array $namespaces = []): DOMXPatharrGetByXpath(string $query, ?DOMNode $contextNode = null, array $namespaces = []): arrayevaluateXpath(string $expression, ?DOMNode $contextNode = null, array $namespaces = []): mixedndGetOneByXpath(string $query, ?DOMNode $contextNode = null, array $namespaces = []): ?DOMNodendAppendError(string $message, string $errorCode = 'XAO_ERROR', array $context = [], ?DOMNode $target = null): DOMElementndAppendException(XaoException $exception, ?DOMNode $target = null): DOMElementstatic parseXmlToDomDocument(string $xml): DOMDocument— rejects empty XML and<!DOCTYPE/<!ENTITYdeclarations.static resolveSafeFilePath(string $filePath, ?string $baseDir = null): string— enforcesrealpath()base-directory containment.
Content Callbacks
Register PHP callables on the document being assembled. Use onElement(string $localName, callable $handler, string $namespaceUri = '') for an element name and onXPath(string $selector, callable $handler, array $namespaces = []) for a node selection. Namespace matching uses the URI, so the author can choose a different prefix in each imported fragment.
Call processContentCallbacks() after importing the fragments and before the XSLT transformation. It selects all matches first, then invokes each handler with one matched node in registration order. Elements added by a handler become eligible on a subsequent explicit pass. Select the owning element for portable edits, since PHC can store leaf text directly on its element.
Xao\DomFactory
Source: src/DomFactory.php
static fromXml(string $xml): DomDocstatic fromFile(string $filePath, ?string $baseDir = null): DomDocstatic fromRoot(string $rootTag, string $version = '1.0', string $encoding = 'UTF-8'): DomDoc
Xao\AppDoc
Source: src/AppDoc.php
Stateless, worker-mode-safe front controller:
__construct(Transformer $transformer, bool $debug = false)isDebugEnabled(): boolregisterRoute(string $path, callable $handler, string $stylesheet, string $contentType = 'text/html; charset=utf-8'): voidhandle(string $rawPath, array $query = []): Response— validates paths, gates?xao:XML=1/?xao:Text=1behind$debug === true, transforms viaTransformer, and returns an immutableResponse.
Xao\Http\Response
Source: src/Http/Response.php
__construct(int $status, string $contentType, string $body, array $headers = [])getStatus(): int,getContentType(): string,getBody(): string,getHeaders(): array,emit(): void
Xao\Exceptions\*
All exceptions extend Xao\Exceptions\XaoException (getErrorCode(), getContext(), toErrorArray()):
Xao\Exceptions\DomDocExceptionXao\Exceptions\XmlParseExceptionXao\Exceptions\DbToXmlExceptionXao\Exceptions\TransformException(addsgetHttpStatus(): int)Xao\Exceptions\XsltTransformException(extendsTransformExceptionfor native/driver XSLT errors)Xao\Exceptions\InvalidSlugException(addsgetHttpStatus(): int)