PHP code example of potaka / bbcode

1. Go to this page and download the library: Download potaka/bbcode 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/ */

    

potaka / bbcode example snippets


$tokenizer = new \Potaka\BbCode\Tokenizer\Tokenizer();

$bbText = '[b]bold[/b]text[u]under[i]line[/i][/u]';

$tokenized = $tokenizer->tokenize($text);
$factory = new  \Potaka\BbCode\Factory();
$bbcode = $factory->getFullBbCode();
$html = $bbcode->format($tokenized);

use Potaka\BbCode;
use Potaka\BbCode\Tokenizer;

use Potaka\BbCode\Tag\Bold;
use Potaka\BbCode\Tag\Underline;
use Potaka\BbCode\Tag\Italic;

use Potaka\BbCode\Tag\Link;

$bbcode = new BbCode();