gemorroj / xbbcode
BBCode parser
2.10.1
2026-10-10 18:33 UTC
Requires
- php: >=8.2
- geshi/geshi: ^v1.0.9.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95
- phpunit/phpunit: ^11.5||^12.5||^13
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Example:
<?php use Xbbcode\Xbbcode; $text = 'Это [b]пример[/b] работы парсера [url=https://github.com/Gemorroj/xBBCode]xBBCode[/url].'; $xbbcode = new Xbbcode(); $xbbcode->parse($text); echo $xbbcode->getHtml();
Requirements:
- PHP >= 8.2
Security Note:
- Geshi has security problem GeSHi/geshi-1.0#159
- This doesn't seem relevant for XbbCode.
- To avoid composer blocking, use
--no-blockingoption.
Installation:
composer require gemorroj/xbbcode --no-blocking
Code highlighting:
- Server-side (default) — GeSHi;
num,tab,extra,links,titleandfooterare rendered by PHP. The markup carries CSS classes only, so colors come fromresources/style.cssand no JS is needed. - Client-side —
$xbbcode->setCodeHighlighting(false)emits plain<pre><code class="language-*">plusdata-*hints for the highlighter (num→data-start,tab→data-tab-width,extra→data-highlight-lines,links→data-keyword-links). Colors come from the highlighter's theme.
Notes:
- Optional styling:
resources/style.css. Colors follow the pagecolor-schemevialight-dark()— declarecolor-scheme: darkfor the dark palette; any--xbbcode-*variable can be overridden. [spoiler]/[hide]render native<details>; the legacySpoilerhandler is deprecated.
License:
- GNU GPL v 2