PHPackages                             csrdelft/bb - 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. csrdelft/bb

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

csrdelft/bb
===========

C.S.R. BB Parser

v1.3.6(3y ago)13.3k1[2 PRs](https://github.com/csrdelft/bb/pulls)MITPHPPHP &gt;=7.3.14CI failing

Since Jul 6Pushed 3mo ago5 watchersCompare

[ Source](https://github.com/csrdelft/bb)[ Packagist](https://packagist.org/packages/csrdelft/bb)[ Docs](https://csrdelft.github.io/bb)[ RSS](/packages/csrdelft-bb/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (2)Versions (23)Used By (0)

C.S.R. BB Parser
================

[](#csr-bb-parser)

This package was originally based on [eamBBParser](https://sourceforge.net/projects/eambbparser/). Some parser internals are still based on that implementation.

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

[](#installation)

Install with composer

```
composer require csrdelft/bb

```

Usage
-----

[](#usage)

Either use the `DefaultParser` or implement your own parser.

```
$parser = new \CsrDelft\bb\DefaultParser();

echo $parser->getHtml('[h=1]Hello World[/h]');
```

### Tags

[](#tags)

The default tags available are:

Tag nameDescription`[b]`Bold text`[i]`Italic`[u]`Underline`[s]`Strikethrough`[sub]`Subscript`[sup]`Superscript`[clear]`Clear`[code]`Code block`[commentaar]`Comment`[div class=? w=? h=? float=left/right clear?]`Div`[email]`Email`[h]`Header`[hr]`Horizontal rule`[1337]`Leet speak`[lishort]`, `[*]`List item`[list]`, `[ulist]`List`[li]`List item`[me]`/me`[rn]`New line`[nobold]`Disable `[b]``[quote]`Blockquote`[table]`Table element`[td]`Table cell`[th]`Table header`[tr]`Table Row### Custom tags

[](#custom-tags)

Tags must extend the `\CsrDelft\bb\BbTag` class. Tags must implement the `parse($arguments)` and `getTagName()` methods.

The `getTagName` method retuns a string or list of strings with the name(s) of this tag.

The `parse` method receives a map of arguments. The `readContent` method can be used to retrieve the contents of the tag, this content is parsed by the parser when it is received. The parser reads the input until an end tag is found. `readContent` has an optional parameter for tags which are forbidden to be in this tag. For instance a `[sup]`tag cannot contain another sup tag or a sub tag.

A tag has access to an environment, which is by default of type `CsrDelft\bb\BBenv` (can be overridden).

### Custom tag example

[](#custom-tag-example)

```
class BbSuperscript extends BbTag {
	public static function getTagName() {
		return 'sup';
	}

	public function render() {
		return '' . $this->getContent() . '';
	}

    public function parse($arguments = []) {
         $this->readContent(['sub', 'sup']);
       }
}
```

### Custom parser

[](#custom-parser)

A custom parser must extend `Parser` and contains a list of tags in the `$tags` field. See `DefaultParser` for the list of default tags.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance53

Moderate activity, may be stable

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 55.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 ~70 days

Recently: every ~187 days

Total

20

Last Release

1166d ago

Major Versions

v1.3.3 → v2.x-dev2021-02-26

PHP version history (3 changes)v1.0PHP &gt;=7.0.33

v2.x-devPHP &gt;=7.3.19

v1.3.6PHP &gt;=7.3.14

### Community

Maintainers

![](https://www.gravatar.com/avatar/11a5c870c4f24eb721ceb7c08fd3678a65869c72f127fc88882fc0720d185df9?d=identicon)[qurben](/maintainers/qurben)

---

Top Contributors

[![qurben](https://avatars.githubusercontent.com/u/589651?v=4)](https://github.com/qurben "qurben (21 commits)")[![mathcals](https://avatars.githubusercontent.com/u/9559454?v=4)](https://github.com/mathcals "mathcals (16 commits)")[![cbasje](https://avatars.githubusercontent.com/u/45468731?v=4)](https://github.com/cbasje "cbasje (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/csrdelft-bb/health.svg)

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

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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