PHP code example of youthweb / bbcode-parser

1. Go to this page and download the library: Download youthweb/bbcode-parser library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

youthweb / bbcode-parser example snippets


use Youthweb\BBCodeParser\Manager;

$text = '[h1]Hello World![/h1]

This is a [i]simple[/i] test to demonstrate the [b]BBCodeParser[/b].';

$parser = new Manager();
$config = ['parse_headlines' => true];

echo $parser->parse($text, $config);

// "<h1>Hello World!</h1>
//  <p>This is a <i>simple</i> test to demonstrate the <b>BBCodeParser</b>.</p>"