PHPackages                             ph-7/html-to-text - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ph-7/html-to-text

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ph-7/html-to-text
=================

Lightweight package to convert HTML code to plain text (handy for plain text email format).

v2.0.1(3y ago)128.8k↑250%33MITPHPPHP &gt;=7.4.0CI passing

Since Apr 18Pushed 3w ago1 watchersCompare

[ Source](https://github.com/pH-7/Html2Text)[ Packagist](https://packagist.org/packages/ph-7/html-to-text)[ Docs](https://github.com/pH-7)[ GitHub Sponsors](https://github.com/pH-7)[ Fund](https://ko-fi.com/phenry)[ RSS](/packages/ph-7-html-to-text/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (3)

HTML to Plain Text
==================

[](#html-to-plain-text)

A simple, lightweight, and effective "**HTML to Plain Text**" converter for your PHP projects 🪄

📄 Overview
----------

[](#-overview)

[![Ko Fi - Offer Me A Coffee](media/kofi-logo.png)](https://ko-fi.com/phenry)

**Simple. Clean. Efficient.** Just what you need to convert HTML code into plain text 🧹

🐘 PHP Requirement
-----------------

[](#-php-requirement)

- [PHP v7.4](https://www.php.net/releases/7_4_0.php) or newer.

🛠 Installation
--------------

[](#-installation)

```
composer require ph-7/html-to-text

```

If you don't already use composer in your project, include [Composer's autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading) as shown below in your main PHP index file of your project.

```
require __DIR__ . '/vendor/autoload.php';
```

🥳 Usage
-------

[](#-usage)

```
use PH7\HtmlToText\Convert;

$htmlCode = 'Some random paragraphs...';

$this->html2Text = new Convert($htmlCode);
$plainText = $this->html2Text->getText();

echo $plainText;
```

😋 Who cooked it?
----------------

[](#-who-cooked-it)

[![Pierre-Henry Soria](https://camo.githubusercontent.com/2e624b95003073bd56ecb43792155201b96f2e1d11bab1218e2215b6238c6ac2/68747470733a2f2f732e67726176617461722e636f6d2f6176617461722f61323130666536313235336334336338363964373165616564306539303134393f733d323030)](https://ph7.me "Pierre-Henry Soria personal website")

[![@phenrysay](https://camo.githubusercontent.com/ffa4875d833472c2e4ba789ff4d078f9c7ae8e735e5d2efe9534d027c0322b4e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d3030303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d78266c6f676f436f6c6f723d7768697465)](https://x.com/phenrysay "Follow Me on X") [![@pH7Programming](https://camo.githubusercontent.com/6690f404cb91efe3927127c7dae40ed4f401c7d6fbe3ad3635b7ad9ba0b370c2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f596f75547562652d4646303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d796f7574756265266c6f676f436f6c6f723d7768697465)](https://www.youtube.com/@pH7Programming/videos "YouTube Tech Videos") [![pH-7](https://camo.githubusercontent.com/4fcd516e2fde608afc9ddd1330de295d23981c27a9b9d695f8abe51f70a1efc5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d3130303030303f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6f676f436f6c6f723d7768697465)](https://github.com/pH-7 "My GitHub profile")

**[Pierre-Henry Soria](https://ph7.me)**. A super passionate, zen &amp; pragmatic software engineer 😊 Cheese &amp; dark chocolate lover! 🧀🍫😋

️☕️ Are you enjoying it...? You could **[offer me a coffee](https://ko-fi.com/phenry)** if you wish 😋

Projects using it 🚀
-------------------

[](#projects-using-it-)

- [pH7Builder](https://github.com/pH7Software/pH7-Social-Dating-CMS) - [composer.json](https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/99e16af40cbc9bb4de64d1c32e5c49f54a4717c2/composer.json#L73)

⚖️ License
----------

[](#️-license)

**HTML to Text** is generously distributed under *[MIT](https://opensource.org/licenses/MIT)* 🎉 Enjoy!

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance62

Regular maintenance activity

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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

Every ~139 days

Total

4

Last Release

1108d ago

Major Versions

v1.1.0 → v2.0.02022-04-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6d95da236687f1dca4f7d70d60037c70ef217120ea195df23a39a412ba594e0?d=identicon)[ph-7](/maintainers/ph-7)

---

Top Contributors

[![pH-7](https://avatars.githubusercontent.com/u/1325411?v=4)](https://github.com/pH-7 "pH-7 (21 commits)")

---

Tags

converterconvertoremail-text-parsinghtmlhtml-converterhtml-convertorhtml-text-conversionhtml2texthtml2text-converterhtmltotextphpphp7plain-textsymfony-mailertexttext-convertertext-convertorconverthtmlconvertertextplain texthtml2texthtml-to-textconvertor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ph-7-html-to-text/health.svg)

```
[![Health](https://phpackages.com/badges/ph-7-html-to-text/health.svg)](https://phpackages.com/packages/ph-7-html-to-text)
```

###  Alternatives

[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5244.3M79](/packages/ckeditor-ckeditor)[iamcal/php-emoji

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

1.3k528.3k](/packages/iamcal-php-emoji)[tinymce/tinymce

Web based JavaScript HTML WYSIWYG editor control.

1707.9M118](/packages/tinymce-tinymce)[unisharp/laravel-ckeditor

JavaScript WYSIWYG web text editor (for laravel).

375765.1k5](/packages/unisharp-laravel-ckeditor)[w8tcha/ckeditor-wordcount-plugin

WordCount Plugin for CKEditor Editor

77478.1k](/packages/w8tcha-ckeditor-wordcount-plugin)[magyarandras/amp-converter

A library to convert HTML articles, blog posts or similar content to AMP (Accelerated Mobile Pages).

65154.1k](/packages/magyarandras-amp-converter)

PHPackages © 2026

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