PHPackages                             chillerlan/php-bbcode - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. chillerlan/php-bbcode

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

chillerlan/php-bbcode
=====================

A powerful, extensive recursive regexp BBCode parser. PHP 7.2+

2.0.0(7y ago)44721[2 issues](https://github.com/chillerlan/php-bbcode/issues)MITPHPPHP ^7.2

Since Jan 23Pushed 6y ago3 watchersCompare

[ Source](https://github.com/chillerlan/php-bbcode)[ Packagist](https://packagist.org/packages/chillerlan/php-bbcode)[ Docs](https://github.com/chillerlan/php-bbcode)[ RSS](/packages/chillerlan-php-bbcode/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

chillerlan/php-bbcode
=====================

[](#chillerlanphp-bbcode)

A recursive regexp [BBCode](http://en.wikipedia.org/wiki/BBCode) parser for PHP 7+ using [preg\_replace\_callback()](http://php.net/preg_replace_callback), based on an example by [MrNiceGuy](http://www.developers-guide.net/forums/member/69,mrniceguy) on [developers-guide.net](http://www.developers-guide.net/c/152-bbcode-parser-mit-noparse-tag-selbst-gemacht.html). Handles nested tags as well as matching brackets and doesn't stumble across invalid tags.

[![version](https://camo.githubusercontent.com/52ae03ae13489c08324a33f4bb116df258e8477e1c11bf1fcb90e019ff0d2206/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368696c6c65726c616e2f7068702d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chillerlan/php-bbcode)[![license](https://camo.githubusercontent.com/ace9901dc2371a41b4e1d34a6fc88d07de364299fdc2bbf53b4fe714f2bf550d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6368696c6c65726c616e2f7068702d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://github.com/chillerlan/php-bbcode/blob/master/LICENSE)[![Travis](https://camo.githubusercontent.com/d1fa834b8896d40f755fec8eb16f06c29309eeeb1af4f269b2db150a640029a5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6368696c6c65726c616e2f7068702d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/chillerlan/php-bbcode)[![Coverage](https://camo.githubusercontent.com/48063d41d087ce34fa594b367b7443b3db338e5da5519d6afb0d93650940f566/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6368696c6c65726c616e2f7068702d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/chillerlan/php-bbcode)[![Scrunitizer](https://camo.githubusercontent.com/15c7498f0774574d5b7f9d01baf29a615fe1b16c41acdb288a82fffd0a566da0/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6368696c6c65726c616e2f7068702d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/chillerlan/php-bbcode)[![Packagist downloads](https://camo.githubusercontent.com/8695d31886793ecd37fb50ed158adecd673c2273f8888928efa3908411d041c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6368696c6c65726c616e2f7068702d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/chillerlan/php-bbcode/stats)[![PayPal donate](https://camo.githubusercontent.com/1898364bc025197736eadf98f27b48ed82c6c63b9ba33e201eaae5cbde03ae42/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d6666333361612e7376673f7374796c653d666c61742d737175617265)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WLYUNAT9ZTJZ4)

Requirements
============

[](#requirements)

- PHP 7.2+

Documentation
=============

[](#documentation)

Installation
------------

[](#installation)

**requires [composer](https://getcomposer.org)**

### *composer.json*

[](#composerjson)

(note: replace `dev-master` with a [version boundary](https://getcomposer.org/doc/articles/versions.md#summary))

```
{
	"require": {
		"php": ">=7.2.0",
		"chillerlan/php-bbcode": "dev-master"
	}
}
```

### Manual installation

[](#manual-installation)

Download the desired version of the package from [master](https://github.com/chillerlan/php-bbcode/archive/master.zip) or [release](https://github.com/chillerlan/php-bbcode/releases) and extract the contents to your project folder. After that:

- run `composer install` to install the required dependencies and generate `/vendor/autoload.php`.
- if you use a custom autoloader, point the namespace `chillerlan\BBCode` to the folder `src` of the package

Profit!

Usage
-----

[](#usage)

- @todo

For an [implementation example](https://github.com/codemasher/gw1-database/blob/master/public/gwbbcode.php) see the GWBBCoder over here: [gw1-database/GWBBCode](https://github.com/codemasher/gw1-database/tree/master/src/GWBBCode).

### Language

[](#language)

- @todo

Notes
-----

[](#notes)

The parser may cause some high CPU load, depending on the input. You should never consider to use it somewhere in your output subsystem - encode on input - you'll want a preview anyway. ;)

You may also run into several bugs. In fact, the BBCoder is essentially a tool to squeeze out any PCRE related bug in PHP known to man (and perhaps unknown). Have fun! ;) [It is highly recommended to use these php.ini settings](https://github.com/chillerlan/php-bbcode/blob/master/travis-php.ini), especially to disable the PCRE JIT in PHP7 which is a troublemaker. In case you happen to run into a PCRE related bug, i ask you to open an issue over here along with the bbcode which caused the error and further information.

Disclaimer!
-----------

[](#disclaimer)

I don't take responsibility for molten CPUs, smashed keyboards, broken HTML etc.. Use at your own risk!

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~372 days

Total

2

Last Release

2661d ago

Major Versions

1.2.0 → 2.0.02019-01-30

PHP version history (2 changes)1.2.0PHP &gt;=7.0.0

2.0.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/ada3d048807a11e536645fb87da881170b18f34c0c61fa09e34807c5d79e0b89?d=identicon)[codemasher](/maintainers/codemasher)

---

Top Contributors

[![codemasher](https://avatars.githubusercontent.com/u/592497?v=4)](https://github.com/codemasher "codemasher (244 commits)")

---

Tags

bbcodebbcode-parserhtml5markdownphpphp-libraryphp7parserHTML5markdownbbcode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/chillerlan-php-bbcode/health.svg)

```
[![Health](https://phpackages.com/badges/chillerlan-php-bbcode/health.svg)](https://phpackages.com/packages/chillerlan-php-bbcode)
```

###  Alternatives

[erusev/parsedown

Parser for Markdown.

15.0k151.8M732](/packages/erusev-parsedown)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k404.0M702](/packages/league-commonmark)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[erusev/parsedown-extra

An extension of Parsedown that adds support for Markdown Extra.

84314.8M192](/packages/erusev-parsedown-extra)[thunderer/shortcode

Advanced shortcode (BBCode) parser and engine for PHP

3892.6M44](/packages/thunderer-shortcode)[ressio/pharse

Fastest PHP HTML Parser

8478.4k](/packages/ressio-pharse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
