PHPackages                             usox/html2text - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. usox/html2text

AbandonedArchivedLibrary[Mail &amp; Notifications](/categories/mail)

usox/html2text
==============

A hacklang script to convert HTML into a plain text format

v1.0.0(7y ago)112MITHTML

Since Feb 27Pushed 7y ago1 watchersCompare

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

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

html2text [![Build Status](https://camo.githubusercontent.com/2db9aab15a25750917ae803b8329cf613e899c26c22c7910842c3f11e202fb03/68747470733a2f2f7472617669732d63692e6f72672f75736f782f68746d6c32746578742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/usox/html2text) [![Total Downloads](https://camo.githubusercontent.com/a23726c1283397194c249ffeb72c2d0442e133c1155504f86104b8ec3a1b4269/68747470733a2f2f706f7365722e707567782e6f72672f75736f782f68746d6c32746578742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/usox/html2text)
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#html2text--)

html2text is a very simple script that uses DOM methods to convert HTML into a format similar to what would be rendered by a browser - perfect for places where you need a quick text representation. For example:

```

Ignored Title

  Hello, World!

  This is some e-mail content.
  Even though it has whitespace and newlines, the e-mail converter
  will handle it correctly.

  Even mismatched tags.

  A div
  Another div
  A divwithin a div

  A link

```

Will be converted into:

```
Hello, World!

This is some e-mail content. Even though it has whitespace and newlines, the e-mail converter will handle it correctly.

Even mismatched tags.

A div
Another div
A div
within a div

[A link](http://foo.com)

```

Installing
----------

[](#installing)

You can use [Composer](http://getcomposer.org/) to add the [package](https://packagist.org/packages/soundasleep/html2text) to your project:

```
{
  "require": {
    "usox/html2text": "^1"
  }
}
```

And then use it quite simply:

```
$converter = new \Usox\Html2Text()
$text = $converter->convert($html);
```

You can also include the supplied `html2text.php` and use `$text = convert_html_to_text($html);` instead.

### Options

[](#options)

OptionDefaultDescription**ignore\_errors**`false`Set to `true` to ignore any XML parsing errors/warnings.**drop\_links**`false`Set to `true` to not render links as `[http://foo.com](My Link)`, but rather just `My Link`.Pass along options as a second argument to `convert`, for example:

```
$html = 'some fine html';
$options = dict[
  'ignore_errors' => true,
  // other options go here
];
$converter = new \Usox\Html2Text()
echo $converter->convert($html, $options);
```

Tests
-----

[](#tests)

Some very basic tests are provided in the `tests/` directory. Run them with `composer install && vendor/bin/hacktest tests`.

License
-------

[](#license)

`html2text` is [licensed under MIT](LICENSE.md), making it suitable for both Eclipse and GPL projects.

Other versions
--------------

[](#other-versions)

This is a port of the php version found [here](https://github.com/soundasleep/html2text).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

2634d ago

### Community

Maintainers

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

---

Top Contributors

[![usox](https://avatars.githubusercontent.com/u/5184763?v=4)](https://github.com/usox "usox (5 commits)")

---

Tags

converterhacklanghhvmhtmlhtmltotextmailtextemailhtmlhhvmtexthack

### Embed Badge

![Health badge](/badges/usox-html2text/health.svg)

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

###  Alternatives

[soundasleep/html2text

A PHP script to convert HTML into a plain text format

48419.5M75](/packages/soundasleep-html2text)[snowfire/beautymail

Send beautiful html emails with Laravel

1.3k733.1k2](/packages/snowfire-beautymail)[voku/html2text

Only a Fork of -&gt; html2text: Converts HTML to formatted plain text

39335.8k2](/packages/voku-html2text)[osiemsiedem/laravel-autolink

A Laravel package for converting URLs in a given string of text into clickable links.

13126.3k](/packages/osiemsiedem-laravel-autolink)

PHPackages © 2026

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