PHPackages                             ivuorinen/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. ivuorinen/bbcodeparser

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

ivuorinen/bbcodeparser
======================

Parse your BBCode easy with this library.

v3.0(7y ago)050[1 issues](https://github.com/ivuorinen/bbcodeparser/issues)MITPHPPHP &gt;=7CI passing

Since Jun 8Pushed 8mo ago1 watchersCompare

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

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

[![Latest Version](https://camo.githubusercontent.com/0ab9fa0ed724c1e95fc4621dca32b10b202fdaf4eb3996e4cdb960ab6fadb6af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6976756f72696e656e2f6262636f64657061727365722e7376673f7374796c653d666c61742d737175617265)](https://github.com/ivuorinen/bbcodeparser/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/f373a913c734f49a912894d202c34c52a8a16169dde27a6f5be629586e603acf/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6976756f72696e656e2f6262636f64657061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ivuorinen/bbcodeparser)[![Coverage Status](https://camo.githubusercontent.com/30f3173b1bcf9b531a2f36ebc78fd1c79b6ee94012a72ff99d2e3fd9c701f8c1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6976756f72696e656e2f6262636f64657061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ivuorinen/bbcodeparser/code-structure)[![Quality Score](https://camo.githubusercontent.com/3cd7ebe2333b52a9f35a1be3a8a31487ba4c6f111daa84713820f90480ef6187/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6976756f72696e656e2f6262636f64657061727365722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ivuorinen/bbcodeparser)[![Total Downloads](https://camo.githubusercontent.com/296bee923c8ef236f7940798b0a2e503cbbfd71bbd2ce1fb97ceb645aeb39a83/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6976756f72696e656e2f6262636f64657061727365722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ivuorinen/bbcodeparser)

The `ivuorinen\BBCodeParser` package will help you with parsing BBCode. This package is build on work by [Joseph Landberg](https://github.com/golonka).

Install
-------

[](#install)

Via Composer

```
composer require ivuorinen/bbcodeparser

```

Usage
-----

[](#usage)

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

```
$bbcode = new ivuorinen\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 ivuorinen\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 ivuorinen\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 ivuorinen\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 ivuorinen\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. This package supports Laravel Package Auto-Discovery, so it should be picked up automatically.

If you don't want auto-discovery, or because of old habits, just open your `app.php` config file.

In there you just add this to your providers array

```
'ivuorinen\BBCode\BBCodeParserServiceProvider'
```

And this to your facades array

```
'BBCode' => 'ivuorinen\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)

```
composer test
```

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

[](#contributing)

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

Credits
-------

[](#credits)

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

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance43

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

2898d ago

### Community

Maintainers

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

---

Top Contributors

[![ivuorinen](https://avatars.githubusercontent.com/u/11024?v=4)](https://github.com/ivuorinen "ivuorinen (59 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (40 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (20 commits)")

---

Tags

bbcodebbcode-parserlaravellaravel-packageparserphplaravelparserPSR-4PSR-2bbcodePSR-1

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/ivuorinen-bbcodeparser/health.svg)](https://phpackages.com/packages/ivuorinen-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)
