Forum, a bundle for forum software


use s9e\TextFormatter\Bundles\Forum as TextFormatter;

$text = '[quote="John Doe"]Star Wars spoiler: [spoiler]Snapes kills Dumbledore[/spoiler][/quote]';
$xml  = TextFormatter::parse($text);
$html = TextFormatter::render($xml);

echo $html;
<blockquote><div><cite>John Doe wrote:</cite>Star Wars spoiler: <details class="spoiler"><summary class="spoiler-header" data-hide="Hide" data-show="Show">Spoiler </summary><div class="spoiler-content">Snapes kills Dumbledore</div></details></div></blockquote>


  • Autoemail
  • Autolink
  • BBCodes
  • Emoji
  • Emoticons
  • MediaEmbed


BBCodes enabled: b, center, code, color, email, i, img, list, li, *, media, quote, s, size, spoiler, u, url. Media BBCodes: Bandcamp, Dailymotion, Facebook, Indiegogo, Instagram, Kickstarter, Liveleak, Soundcloud, Twitch, Twitter, Vimeo, Vine, WSHH, YouTube.

Emoji and Emoticons

Emoji are supported thanks to the free image set from Twemoji. Please consult their website for license terms.

The following emoticons are also supported as an alias to the corresponding emoji: :) :-) ;) ;-) :D :-D :( :-( :-* :P :-P :p :-p ;P ;-P ;p ;-p :? :-? :| :-| :o :lol:


use s9e\TextFormatter\Bundles\Forum as TextFormatter;

$text = '[quote="John Doe"]Star Wars spoiler :) [spoiler]Spocks kills Dumbledore[/spoiler][/quote]';
$xml  = TextFormatter::parse($text);
$html = TextFormatter::render($xml, [
    // Translatable strings used in [quote] and [spoiler]
    'L_WROTE'   => 'escribió:',
    'L_HIDE'    => 'Ocultar',
    'L_SHOW'    => 'Mostrar',
    'L_SPOILER' => 'Spoiler'

echo $html;
<blockquote><div><cite>John Doe escribió:</cite>Star Wars spoiler <img alt=":)" class="emoji" draggable="false" src=""> <details class="spoiler"><summary class="spoiler-header" data-hide="Ocultar" data-show="Mostrar">Spoiler </summary><div class="spoiler-content">Spocks kills Dumbledore</div></details></div></blockquote>