A lightweight but extensible BBCode parser written in PHP 5.3.

Installs: 18 004

Dependents: 5

Stars: 104

Watchers: 20

Forks: 26

Open Issues: 18

v1.3.0 2014-07-06 05:48 UTC


GitHub release Software License Build Status

jBBCode is a bbcode parser written in php 5.3. It's relatively lightweight and parses bbcodes without resorting to expensive regular expressions.


For complete documentation and examples visit jbbcode.com.

A basic example

jBBCode includes a few optional, default bbcode definitions that may be loaded through the DefaultCodeDefinitionSet class. Below is a simple example of using these codes to convert a bbcode string to html.

require_once "/path/to/jbbcode/Parser.php";

$parser = new JBBCode\Parser();
$parser->addCodeDefinitionSet(new JBBCode\DefaultCodeDefinitionSet());

$text = "The default codes include: [b]bold[/b], [i]italics[/i], [u]underlining[/u], ";
$text .= "[url=http://jbbcode.com]links[/url], [color=red]color![/color] and more.";


print $parser->getAsHtml();


You may load jBBCode via composer. In your composer.json file:

"require": {
    "jbbcode/jbbcode": "1.3.*"

In your php file:

require 'vendor/autoloader.php';

$parser = new JBBCode\Parser();


I would love help maintaining jBBCode. Look at open issues for ideas on what needs to be done. Before submitting a pull request, verify that all unit tests still pass.

Running unit tests

To run the unit tests, ensure that phpunit is installed, or install it through the composer dev dependencies. Then run phpunit from the project directory. If you're adding new functionality, writing additional unit tests is a great idea.


jBBCode was written by Jackson Owens. You may reach him at jackson_owens@alumni.brown.edu.

Other languages

This library is in the process of being ported to java. For more information, see jBBCode-java.


The project is under MIT license. Please see the license file for details.