PHPackages                             pherum/laravel-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. pherum/laravel-bbcode

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

pherum/laravel-bbcode
=====================

Parse your BBCode easy with this library.

v1.1(5y ago)2427.5k—8.7%10[1 issues](https://github.com/PheRum/laravel-bbcode/issues)MITPHP

Since Dec 27Pushed 5y ago2 watchersCompare

[ Source](https://github.com/PheRum/laravel-bbcode)[ Packagist](https://packagist.org/packages/pherum/laravel-bbcode)[ Docs](https://github.com/pherum/laravel-bbcode)[ RSS](/packages/pherum-laravel-bbcode/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

Laravel BBCode
==============

[](#laravel-bbcode)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2793a286fa3b51b5a666b49ea769a749b9437172884364c15033082f556f55d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70686572756d2f6c61726176656c2d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/PheRum/laravel-bbcode)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0381b7fbf8e3d75c6e763d91df98c37c8f84a96a666b12e66d6dfac3fcb5ba15/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f70686572756d2f6c61726176656c2d6262636f64652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/PheRum/laravel-bbcode)[![StyleCI](https://camo.githubusercontent.com/4eb7aba77d0976a30a5a064697625a96d80d97dbd9ec2e4206ec2bf1891f221d/68747470733a2f2f7374796c6563692e696f2f7265706f732f36353639303539372f736869656c64)](https://styleci.io/repos/115532859)[![Quality Score](https://camo.githubusercontent.com/d098ab97eb58b7fc41c871043cc60dc69bbd1fd273453cbc5d6235f9331e3c5e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f70686572756d2f6c61726176656c2d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/PheRum/laravel-bbcode)[![Total Downloads](https://camo.githubusercontent.com/2451e7f807ef102c35823fb88de44cbb546ee28c9d7b5271d32e42a30714754b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70686572756d2f6c61726176656c2d6262636f64652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/PheRum/laravel-bbcode)

Description
-----------

[](#description)

Parse your BBCode easy with laravel-bbcode

Install
-------

[](#install)

Via Composer

```
composer require pherum/laravel-bbcode
```

Usage
-----

[](#usage)

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

```
$bbcode = new PheRum\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 PheRum\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 PheRum\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 PheRum\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 PheRum\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 5. Just open your `app.php` config file.

In there you just add this to your providers array

```
PheRum\BBCode\BBCodeServiceProvider::class,
```

And this to your facades array

```
'BBCode' => PheRum\BBCode\Facades\BBCode::class,
```

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)

- [PheRum](https://github.com/pherum)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~171 days

Recently: every ~300 days

Total

8

Last Release

1863d ago

### Community

Maintainers

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

---

Top Contributors

[![pherum](https://avatars.githubusercontent.com/u/3333352?v=4)](https://github.com/pherum "pherum (15 commits)")[![jarrodwoerner](https://avatars.githubusercontent.com/u/32343389?v=4)](https://github.com/jarrodwoerner "jarrodwoerner (1 commits)")[![LeCodeurDuDimanche](https://avatars.githubusercontent.com/u/43851820?v=4)](https://github.com/LeCodeurDuDimanche "LeCodeurDuDimanche (1 commits)")[![writen](https://avatars.githubusercontent.com/u/4375649?v=4)](https://github.com/writen "writen (1 commits)")

---

Tags

bbcodelaravellaravel-bbcodelaravelparserbbcode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pherum-laravel-bbcode/health.svg)

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

###  Alternatives

[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[mischasigtermans/laravel-toon

Token-Optimized Object Notation encoder/decoder for Laravel with intelligent nested object handling

13113.1k](/packages/mischasigtermans-laravel-toon)[illuminated/wikipedia-grabber

Wikipedia/MediaWiki Grabber for Laravel.

477.3k](/packages/illuminated-wikipedia-grabber)

PHPackages © 2026

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