PHP code example of chriskonnertz / bbcode

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

    

chriskonnertz / bbcode example snippets


$bbcode = new ChrisKonnertz\BBCode\BBCode();

$rendered = $bbcode->render('[b]Hello world![/b]');

echo $rendered;

$bbcode->addTag('h1', function($tag, &$html, $openingTag) {
    if ($tag->opening) {
        return '<h1>';
    } else {
        return '</h1>';
    }
});