PHPackages                             vereniging-lvak/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. vereniging-lvak/html2text

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

vereniging-lvak/html2text
=========================

A PHP script to convert HTML into a plain text format

v3.0.0(8mo ago)04MITHTMLPHP ^7.3|^8.0CI passing

Since Sep 17Pushed 8mo agoCompare

[ Source](https://github.com/vereniging-LVAK/html2text)[ Packagist](https://packagist.org/packages/vereniging-lvak/html2text)[ Docs](https://github.com/vereniging-LVAK/html2text)[ RSS](/packages/vereniging-lvak-html2text/feed)WikiDiscussions main Synced 1mo ago

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

[![example workflow](https://github.com/soundasleep/html2text/actions/workflows/test.yml/badge.svg)](https://github.com/soundasleep/html2text/actions/workflows/test.yml/badge.svg) [![Total Downloads](https://camo.githubusercontent.com/9e4a7d4a0a88d868d5ec5b11b5a29d2b5bb620adc808bdcfb242347954b886d2/68747470733a2f2f706f7365722e707567782e6f72672f736f756e6461736c6565702f68746d6c32746578742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/soundasleep/html2text)
========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#-)

Note: this library has been changed, link format is different as the original library

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

```

See the [original blog post](http://journals.jevon.org/users/jevon-phd/entry/19818) or the related [StackOverflow answer](http://stackoverflow.com/a/2564472/39531).

Installing
----------

[](#installing)

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

```
{
  "require": {
    "soundasleep/html2text": "~1.1"
  }
}
```

And then use it quite simply:

```
$text = \VerenigingLVAK\Html2Text::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.**drop\_links**`false`Set to `true` to not render links as `http://foo.com: My Link`, but rather just `My Link`.**char\_set**`'auto'`Specify a specific character set. Pass multiple character sets (comma separated) to detect encoding, default is ASCII,UTF-8Pass along options as a second argument to `convert`, for example:

```
$options = array(
  'ignore_errors' => true,
  // other options go here
);
$text = \VerenigingLVAK\Html2Text::convert($html, $options);
```

Tests
-----

[](#tests)

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

Troubleshooting
---------------

[](#troubleshooting)

### Class 'DOMDocument' not found

[](#class-domdocument-not-found)

You need to [install the PHP XML extension](https://github.com/soundasleep/html2text/issues/55) for your PHP version. e.g. `apt-get install php7.4-xml`

License
-------

[](#license)

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

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

[](#other-versions)

Also see [html2text\_ruby](https://github.com/soundasleep/html2text_ruby), a Ruby implementation.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance61

Regular maintenance activity

Popularity3

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 63.4% 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

244d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c47dcd21ec753b97eeec28b0673766cfdfaa069dcef657f38d4e0f3fe091df07?d=identicon)[vereniging-LVAK](/maintainers/vereniging-LVAK)

---

Top Contributors

[![soundasleep](https://avatars.githubusercontent.com/u/3889656?v=4)](https://github.com/soundasleep "soundasleep (85 commits)")[![phpfui](https://avatars.githubusercontent.com/u/7434059?v=4)](https://github.com/phpfui "phpfui (14 commits)")[![bochoven](https://avatars.githubusercontent.com/u/1429002?v=4)](https://github.com/bochoven "bochoven (12 commits)")[![edgrosvenor](https://avatars.githubusercontent.com/u/1053395?v=4)](https://github.com/edgrosvenor "edgrosvenor (7 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (2 commits)")[![vanhoavn](https://avatars.githubusercontent.com/u/3288188?v=4)](https://github.com/vanhoavn "vanhoavn (2 commits)")[![maskas](https://avatars.githubusercontent.com/u/1159983?v=4)](https://github.com/maskas "maskas (1 commits)")[![pethersonmorenosqg](https://avatars.githubusercontent.com/u/9138772?v=4)](https://github.com/pethersonmorenosqg "pethersonmorenosqg (1 commits)")[![guillaume-ro-fr](https://avatars.githubusercontent.com/u/1820051?v=4)](https://github.com/guillaume-ro-fr "guillaume-ro-fr (1 commits)")[![cyrosy](https://avatars.githubusercontent.com/u/2836107?v=4)](https://github.com/cyrosy "cyrosy (1 commits)")[![Stadly](https://avatars.githubusercontent.com/u/7263579?v=4)](https://github.com/Stadly "Stadly (1 commits)")[![thetaylor82](https://avatars.githubusercontent.com/u/2462662?v=4)](https://github.com/thetaylor82 "thetaylor82 (1 commits)")[![timothyasp](https://avatars.githubusercontent.com/u/707699?v=4)](https://github.com/timothyasp "timothyasp (1 commits)")[![tommygnr](https://avatars.githubusercontent.com/u/929392?v=4)](https://github.com/tommygnr "tommygnr (1 commits)")[![ulrichsg](https://avatars.githubusercontent.com/u/197901?v=4)](https://github.com/ulrichsg "ulrichsg (1 commits)")[![SDKiller](https://avatars.githubusercontent.com/u/2150916?v=4)](https://github.com/SDKiller "SDKiller (1 commits)")[![jaylinski](https://avatars.githubusercontent.com/u/1668766?v=4)](https://github.com/jaylinski "jaylinski (1 commits)")[![manzoorwanijk](https://avatars.githubusercontent.com/u/18226415?v=4)](https://github.com/manzoorwanijk "manzoorwanijk (1 commits)")

---

Tags

phpemailhtmltext

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[soundasleep/html2text

A PHP script to convert HTML into a plain text format

48519.5M75](/packages/soundasleep-html2text)[voku/html2text

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

39335.8k2](/packages/voku-html2text)[henrique-borba/php-sieve-manager

A modern (started in 2022) PHP library for the ManageSieve protocol (RFC5804) to create/edit Sieve scripts (RFC5228). Used by Cypht Webmail.

23125.7k2](/packages/henrique-borba-php-sieve-manager)

PHPackages © 2026

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