forkbb/vendor/miovisman/parserus
2023-06-17 20:03:32 +07:00
..
composer.json Update Parserus 2021-01-06 18:41:23 +07:00
LICENSE Update composer and dependences 2022-01-08 20:45:23 +07:00
Parserus.php this year 2023-06-17 20:03:32 +07:00
README.md Update composer + add psr/log 2021-01-16 17:58:51 +07:00

Parserus

MIT licensed

BBCode parser.

Note

Version 1.x is incompatible with version 0.9.x.

Requirements

  • PHP 7.3.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.