All interaction with PHP Structured Text occurs through the class PhpStructuredText. Each time you need to convert some structured text to (X)HTML, create a new instance of PhpStructuredText, optionally set some properties, then call render or renderAsDom.

Example code

Simple use of the PhpStructuredText class would look something like:

$structuredText = new PhpStructuredText($content);
echo $structuredText->render();

A slightly more complicated use, that sets some properties, then renders to an XML DOM instance for further processing and final conversion to an XML fragment, might look like:

$structuredText = new PhpStructuredText($content);
$structuredText->setExternalVariable("summary", true);
$dom = $structuredText->renderAsDom();

// ...
// ... some DOM manipulations ...
// ...

$xmlFragment = $structuredText->textFromDom($dom);