PHPackages                             phainv/bbcodeparser - 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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. phainv/bbcodeparser

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

phainv/bbcodeparser
===================

Parse your BBCode easy with this library.

1.0.0(8y ago)011.5k↓50%MITPHPPHP &gt;=5.4.0

Since Dec 6Pushed 8y ago1 watchersCompare

[ Source](https://github.com/phainv/bbcodeparser)[ Packagist](https://packagist.org/packages/phainv/bbcodeparser)[ Docs](http://github.com/phainv/bbcodeparser)[ RSS](/packages/phainv-bbcodeparser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Latest Version](https://camo.githubusercontent.com/4ccfc2ea9c8abc0150e49ff0d505182243a42427bfaf87f80195ff92d56232a3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f676f6c6f6e6b612f6262636f64657061727365722e7376673f7374796c653d666c61742d737175617265)](https://github.com/golonka/bbcodeparser/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/8422b2b5f8aa22e3e0a7437847d09ed76063f181e4b1cf780c5d7e6d07a5d075/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f676f6c6f6e6b612f4242436f64655061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/golonka/BBCodeParser)[![Coverage Status](https://camo.githubusercontent.com/e41636751eadca76f1b25788e2468f641a9079d10b3c9d3248e8367eb8ab4c84/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f676f6c6f6e6b612f6262636f64657061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/golonka/bbcodeparser/code-structure)[![Quality Score](https://camo.githubusercontent.com/bbe89cd8384c7b1fa681a65b83488b7c22c66d107e09659bf5ee09ec3aab0827/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f676f6c6f6e6b612f6262636f64657061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/golonka/bbcodeparser)[![Total Downloads](https://camo.githubusercontent.com/746374bc09d0060b4dcdbd07b7ec108f8f7035a9efef53788d59f6932e27971c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f676f6c6f6e6b612f6262636f64657061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/golonka/bbcodeparser)

The `Golonka\BBCodeParser` package will help you with parsing BBCode.

Install
-------

[](#install)

Via Composer

```
$ composer require golonka/bbcodeparser
```

Usage
-----

[](#usage)

To parse some text it's as easy as this!

```
$bbcode = new Golonka\BBCode\BBCodeParser;

echo $bbcode->parse('[b]Bold Text![/b]');
// Bold Text!
```

Would like the parser to not use all bbcodes? Just do like this.

```
$bbcode = new Golonka\BBCode\BBCodeParser;

echo $bbcode->only('bold', 'italic')
            ->parse('[b][u]Bold[/u] [i]Italic[/i]![/b]');
            // [u]Bold[/u] Italic!

echo $bbcode->except('bold')
            ->parse('[b]Bold[/b] [i]Italic[/i]');
            // [b]Bold[/b] Italic
```

By default the parser is case sensitive. But if you would like the parser to accept tags like `[B]Bold Text[/B]` it's really easy.

```
$bbcode = new Golonka\BBCode\BBCodeParser;

// Case insensitive
echo $bbcode->parse('[b]Bold[/b] [I]Italic![/I]', true);
     // Bold Italic!

// Or like this

echo $bbcode->parseCaseInsensitive('[b]Bold[/b] [i]Italic[/i]');
     // Bold Italic!
```

You could also make it more explicit that the parser is case sensitive by using another helper function.

```
    $bbcode = new Golonka\BBCode\BBCodeParser;

    echo $bbcode->parseCaseSensitive('[b]Bold[/b] [I]Italic![/I]');
         // Bold [I]Italic![/I]
```

If you would like to completely remove all BBCode it's just one function call away.

```
    $bbcode = new Golonka\BBCode\BBCodeParser;

    echo $bbcode->stripBBCodeTags('[b]Bold[/b] [i]Italic![/i]');
         // Bold Italic!
```

Laravel integration
-------------------

[](#laravel-integration)

The integration into Laravel is really easy, and the method is the same for both Laravel 4 and Laravel 5. Just open your `app.php` config file.

In there you just add this to your providers array

```
'Golonka\BBCode\BBCodeParserServiceProvider'
```

And this to your facades array

```
'BBCode' => 'Golonka\BBCode\Facades\BBCodeParser'
```

The syntax is the same as if you would use it in vanilla PHP but with the `BBCode::` before the methods. Here are some examples.

```
// Simple parsing
echo BBCode::parse('[b]Bold Text![/b]');

// Limiting the parsers with the only method
echo BBCode::only('bold', 'italic')
        ->parse('[b][u]Bold[/u] [i]Italic[/i]![/b]');
        // [u]Bold[/u] Italic!

// Or the except method
echo BBCode::except('bold')
        ->parse('[b]Bold[/b] [i]Italic[/i]');
        // [b]Bold[/b] Italic
```

Testing
-------

[](#testing)

```
$ phpunit
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Joseph Landberg](https://github.com/golonka)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3085d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13997282?v=4)[Phai Nguyen](/maintainers/phainv)[@phainv](https://github.com/phainv)

---

Top Contributors

[![phainv](https://avatars.githubusercontent.com/u/13997282?v=4)](https://github.com/phainv "phainv (1 commits)")

---

Tags

laravelparserPSR-4PSR-2bbcodePSR-1

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/phainv-bbcodeparser/health.svg)

```
[![Health](https://phpackages.com/badges/phainv-bbcodeparser/health.svg)](https://phpackages.com/packages/phainv-bbcodeparser)
```

###  Alternatives

[genert/bbcode

BBCode parser from or to HTML.

81324.0k1](/packages/genert-bbcode)[icamys/php-sitemap-generator

Simple PHP sitemap generator.

175342.8k6](/packages/icamys-php-sitemap-generator)[evilfreelancer/routeros-api-php

Modern Mikrotik RouterOS API PHP client for your applications (with Laravel support)

491206.1k4](/packages/evilfreelancer-routeros-api-php)[authbucket/oauth2-php

The standard compliant OAuth2.0 library based on the Symfony Components

82107.6k4](/packages/authbucket-oauth2-php)[pherum/laravel-bbcode

Parse your BBCode easy with this library.

2427.5k](/packages/pherum-laravel-bbcode)

PHPackages © 2026

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