PHPackages                             mtawil/converter - 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. mtawil/converter

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

mtawil/converter
================

A set of classes to translate a text from HTML to BBcode and from BBCode to Markdown.

1.6.7(7y ago)0965Apache-2.0PHPPHP &gt;=5.4.0

Since Feb 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mtawil/converter)[ Packagist](https://packagist.org/packages/mtawil/converter)[ Docs](https://github.com/dedalozzo/converter)[ RSS](/packages/mtawil-converter/feed)WikiDiscussions master Synced today

READMEChangelog (8)DependenciesVersions (15)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/c26c54c372466bba4641271c54f017d7d07e4639ee245f1376296c99f6a6fcce/68747470733a2f2f706f7365722e707567782e6f72672f6d746177696c2f636f6e7665727465722f762f737461626c652e706e67)](https://packagist.org/packages/mtawil/converter)[![Latest Unstable Version](https://camo.githubusercontent.com/2f89f0654de8455181e3a107ec54576a0fa10b5235678223d7c6eb10fc30deb8/68747470733a2f2f706f7365722e707567782e6f72672f6d746177696c2f636f6e7665727465722f762f756e737461626c652e706e67)](https://packagist.org/packages/mtawil/converter)[![Build Status](https://camo.githubusercontent.com/93c611ddaa23962d1853de47f7f53f544f02bc5cddccb1dbd7f626e3cf0576dc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d746177696c2f636f6e7665727465722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mtawil/converter/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/936a0035657df4cefed28c4173ce9a4216c66245b343ab49dd085471c9185942/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d746177696c2f636f6e7665727465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mtawil/converter/?branch=master)[![License](https://camo.githubusercontent.com/6e9d5aef90536a1f7e485c4f3ab88f4638b1cbf28a85bfc25cd17eff4a0c7b65/68747470733a2f2f706f7365722e707567782e6f72672f6d746177696c2f636f6e7665727465722f6c6963656e73652e737667)](https://packagist.org/packages/mtawil/converter)[![Total Downloads](https://camo.githubusercontent.com/8265ddaf907bc6e2ff227ccb1eb7bd4fc6bca69e80606b58e6fbc746dd7ab0c4/68747470733a2f2f706f7365722e707567782e6f72672f6d746177696c2f636f6e7665727465722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/mtawil/converter)

Converter
=========

[](#converter)

A set of classes to translate a text **from HTML to BBCode** and **from BBCode to Markdown**.

The HTML to BBCode converter, in particular, has not been created with the intent to convert an entire HTML page, but just to convert a set of HTML tags used to format articles and blog posts in the HTML era, when Markdown and BBcode didn't exist at all.

The special BBCode to Markdown converter is able to convert: bold, italic, underline and strikethrough texts, lists, urls, images, quotes and even code blocks (snippets).

Composer Installation
---------------------

[](#composer-installation)

To install Converter, you first need to install [Composer](http://getcomposer.org/), a Package Manager for PHP, following these few [steps](http://getcomposer.org/doc/00-intro.md#installation-nix):

```
curl -s https://getcomposer.org/installer | php
```

You can run this command to easily access composer from anywhere on your system:

```
sudo mv composer.phar /usr/local/bin/composer
```

Converter Installation
----------------------

[](#converter-installation)

Once you have installed Composer, it's easy install Converter.

Run the following command in your project root dir:

```
composer require mtawil/converter
```

Usage
-----

[](#usage)

There are two classes: `HTMLConverter` and `BBCodeConverter`. The first class may be used to convert from HTML to BBCode, while the second one is used to convert from BBCode to Markdown.

HTML to BBCode conversion:

```
$converter = new Converter\HTMLConverter($text, $id);
echo $converter->toBBCode();
```

BBCode to Markdown conversion:

```
$converter = new Converter\BBCodeConverter($text, $id);
echo $converter->toMarkdown();
```

In both cases the `$id` is optional. When provided is used in case an exception is raised during the conversion process.

Documentation
-------------

[](#documentation)

The documentation can be generated using [Doxygen](http://doxygen.org). A `Doxyfile` is provided for your convenience.

Requirements
------------

[](#requirements)

- PHP 5.4.0 or above.

Authors
-------

[](#authors)

Filippo F. Fadda -  -

[Mohammad @Taweel](https://twitter.com/mtawil7) -

License
-------

[](#license)

Converter is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 75% 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 ~100 days

Recently: every ~1 days

Total

14

Last Release

2785d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1556b00c7301eefff0295fd137af54f29d0b7aafae02882ae644203301d4e64f?d=identicon)[mtawil](/maintainers/mtawil)

---

Top Contributors

[![dedalozzo](https://avatars.githubusercontent.com/u/311248?v=4)](https://github.com/dedalozzo "dedalozzo (45 commits)")[![mtawil](https://avatars.githubusercontent.com/u/700753?v=4)](https://github.com/mtawil "mtawil (13 commits)")[![chellem](https://avatars.githubusercontent.com/u/570856?v=4)](https://github.com/chellem "chellem (1 commits)")[![mhatma](https://avatars.githubusercontent.com/u/4669145?v=4)](https://github.com/mhatma "mhatma (1 commits)")

---

Tags

formatterhtmlconvertermarkdowntranslatorbbcode

### Embed Badge

![Health badge](/badges/mtawil-converter/health.svg)

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

###  Alternatives

[3f/converter

A set of classes to translate a text from HTML to BBcode and from BBCode to Markdown.

29148.7k](/packages/3f-converter)[league/html-to-markdown

An HTML-to-markdown conversion helper for PHP

1.9k28.6M198](/packages/league-html-to-markdown)[pixel418/markdownify

The HTML to Markdown converter for PHP

196800.8k8](/packages/pixel418-markdownify)[texy/texy

Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated against spambots), national typographic single and double quotation marks, ellipses, em dashes, dimension sign, nonbreakable spaces (e.g. in phone numbers), acronyms, arrows and many others. Texy code can optionally contain HTML tags.

161838.9k15](/packages/texy-texy)[interaction-design-foundation/nova-html-card

A Laravel Nova card to display arbitrary HTML content

67731.2k3](/packages/interaction-design-foundation-nova-html-card)[kartik-v/yii2-markdown

Advanced Markdown editing and conversion utilities for Yii Framework 2.0

88265.8k6](/packages/kartik-v-yii2-markdown)

PHPackages © 2026

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