Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
23 lines (16 sloc) 807 Bytes
// Get the autoloader
include __DIR__ . '/../../vendor/autoload.php';
// Use the Forum bundle. It supports BBCodes, emoticons and autolinking
use s9e\TextFormatter\Bundles\Forum as TextFormatter;
// Original text
$text = "Hello, [i]world[/i] :)\nFind more examples in the [url=]documentation[/url].";
// XML representation, that's what you should store in your database
$xml = TextFormatter::parse($text);
// HTML rendering, that's what you display to the user
$html = TextFormatter::render($xml);
echo $html, "\n";
// Outputs:
// Hello, <i>world</i> <img alt=":)" class="emoji" draggable="false" src=""><br>
// Find more examples in the <a href="">documentation</a>.
You can’t perform that action at this time.