PHPackages                             dasred/bb-code-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dasred/bb-code-parser

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

dasred/bb-code-parser
=====================

v1.0.5(10y ago)11.7k1PHPPHP &gt;=5.5

Since Jul 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/DasRed/bbCodeParser)[ Packagist](https://packagist.org/packages/dasred/bb-code-parser)[ Docs](https://github.com/DasRed/bbCodeParser)[ RSS](/packages/dasred-bb-code-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (2)Versions (8)Used By (1)

General
=======

[](#general)

This is a simple BBCode parser.

Installation
============

[](#installation)

```
composer install dasred/bb-code-parser
```

Usage
=====

[](#usage)

Default
-------

[](#default)

```
$parser = new \DasRed\Parser\BBCode();
echo $parser->parse('[b]10.00[/b] seconds'); //  echos "10.00 seconds
```

**following default BBCodes are supported**

```
BBCode                                               | HTML
---------------------------------------------------- | -------------------------------------------------------------
[br]                                                 |
[b]text[/b]                                          | text
[b class="fancy"]text[/b]                            | text
[b data-value="10"]text[/b]                          | text
[i]text[/i]                                          | text
[i class="fancy"]text[/i]                            | text
[i data-value="10"]text[/i]                          | text
[u]text[/u]                                          | text
[u class="fancy"]text[/u]                            | text
[u data-value="10"]text[/u]                          | text
[h1]text[/h1]                                        | text
[h1 class="fancy"]text[/h1]                          | text
[h1 data-value="10"]text[/h1]                        | text
[h2]text[/h2]                                        | text
[h2 class="fancy"]text[/h2]                          | text
[h2 data-value="10"]text[/h2]                        | text
[h3]text[/h3]                                        | text
[h3 class="fancy"]text[/h3]                          | text
[h3 data-value="10"]text[/h3]                        | text
[h4]text[/h4]                                        | text
[h4 class="fancy"]text[/h4]                          | text
[h4 data-value="10"]text[/h4]                        | text
[h5]text[/h5]                                        | text
[h5 class="fancy"]text[/h5]                          | text
[h5 data-value="10"]text[/h5]                        | text
[h6]text[/h6]                                        | text
[h6 class="fancy"]text[/h6]                          | text
[h6 data-value="10"]text[/h6]                        | text
[p]text[/p]                                          | text
[p class="fancy"]text[/p]                            | text
[p data-value="10"]text[/p]                          | text
[color=#FF0000]text[/color]                          | text
[size=9]text[/size]                                  | text
[img]https://www.example.com/image.jpg[/img]         |
[img=https://www.example.com/image.jpg]              |
[email]info@example.com[/email]                      | info@example.com
[email=info@example.com]text[/email]                 | text
[url]https://www.example.com[/url]                   | https://www.example.com
[url=alert('hello world')|onclick]text[/url]         | text
[url=https://www.example.com target=_base]text[/url] | text
[url=https://www.example.com]text[/url]              | text
[a=anker]text[/a]                                    | text
[list]text[/list]                                    | text
[*]text[/*]                                          | text

```

Own BBCodes
-----------

[](#own-bbcodes)

You can provide your own BBCodes.

You must create a config file with following structure. For example the file could be located at /var/www/bbcode.config.php

```
