forkbb/vendor/miovisman/parserus
2017-11-30 10:08:32 +07:00
..
composer.json 2017-10-03 2017-10-03 21:13:21 +07:00
LICENSE 2017-11-30 2017-11-30 10:08:32 +07:00
Parserus.php 2017-11-30 2017-11-30 10:08:32 +07:00
README.md 2017-10-03 2017-10-03 21:13:21 +07:00

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.