PHP
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
tests
.gitattributes
.travis.yml
LICENSE
Parserus.php
README.md
composer.json
phpunit.xml.dist

README.md

Parserus

MIT licensed

BBCode parser.

Requirements

  • PHP 5.4.0

Installation

Include Parserus.php or install the composer package.

Example

$parser = new Parserus();

echo $parser->addBBCode([
    'tag' => 'b',
    'handler' => function($body) {
        return '<b>' . $body . '</b>';
    }
])->addBBcode([
    'tag' => 'i',
    'handler' => function($body) {
        return '<i>' . $body . '</i>';
    },
])->parse("[i]Hello\n[b]World[/b]![/i]")
->getHTML();

#output: <i>Hello<br><b>World</b>!</i>

More examples in the wiki.

License

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