PHPackages                             purplebooth/htmlstrip - 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. purplebooth/htmlstrip

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

purplebooth/htmlstrip
=====================

Convert a small subset of html into something reasonable you can put in plain text email, or SMS.

1.0.2(8y ago)237.1k4[2 PRs](https://github.com/PurpleBooth/htmlstrip/pulls)MITPHPPHP &gt;=5.4.0

Since Jul 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/PurpleBooth/htmlstrip)[ Packagist](https://packagist.org/packages/purplebooth/htmlstrip)[ RSS](/packages/purplebooth-htmlstrip/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (4)Versions (7)Used By (0)

htmlstrip
=========

[](#htmlstrip)

A class to convert a small subset of html into something reasonable you can put in plain text email, or SMS.

[![Build Status](https://camo.githubusercontent.com/5ff5f0fee26c4c4ff1cac58cea0ddb6c4579cee2b5cf3ae783df28c84cb806b2/68747470733a2f2f7472617669732d63692e6f72672f507572706c65426f6f74682f68746d6c73747269702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PurpleBooth/htmlstrip)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ce8446d15defd1ae6553bb16828608b79317afb5c27ee0605639f6de6404cb28/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f507572706c65426f6f74682f68746d6c73747269702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PurpleBooth/htmlstrip/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/1c0c783ec37644a8e2a8a9686bbb9c182a039a8e2ee30d147a1ff6ed6640c7c0/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f507572706c65426f6f74682f68746d6c73747269702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/PurpleBooth/htmlstrip?branch=master)[![Dependency Status](https://camo.githubusercontent.com/81a49d70c7ed5f5d8ce2825aef3be32c893c7d459b42544d25c2d77779e88ced/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537393532343639623465383663303033376339666362362f62616467652e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/57952469b4e86c0037c9fcb6)[![Latest Stable Version](https://camo.githubusercontent.com/06c69e7ffb6ae7a4a0cc478c27ed4a2c0c4d036721b56d7cced04bb78784c837/68747470733a2f2f706f7365722e707567782e6f72672f707572706c65626f6f74682f68746d6c73747269702f762f737461626c65)](https://packagist.org/packages/purplebooth/htmlstrip)[![Total Downloads](https://camo.githubusercontent.com/0e5be691bdef01d945f8a77999eb71917ea10fdf152ffb96f6565e05be3230e4/68747470733a2f2f706f7365722e707567782e6f72672f707572706c65626f6f74682f68746d6c73747269702f646f776e6c6f616473)](https://packagist.org/packages/purplebooth/htmlstrip)[![License](https://camo.githubusercontent.com/04c9c75809eca49759ab9343f05b2f3610a92ba987cb05ac23d5e629b3bc34a0/68747470733a2f2f706f7365722e707567782e6f72672f707572706c65626f6f74682f68746d6c73747269702f6c6963656e7365)](https://packagist.org/packages/purplebooth/htmlstrip)

How To Use
----------

[](#how-to-use)

Add the dependency to your composer.json

```
php composer.phar require purplebooth/htmlstrip:^1.0.0
```

And use it!

```
$htmlStripper = new PurpleBooth\HtmlStripperImplementation();
$htmlStripper->("Hello, world.")
// -> "Hello, world."

```

I recommend that you depend upon our interface when you do type checking

```
use PurpleBooth\HtmlStripper;

class YourClass
{

    public function __construct(HtmlStripper $htmlStrip)
    {
        ... etc ...

```

Examples
--------

[](#examples)

Input:

```
Hello, world.
```

Output:

```
Hello, world.

```

Input:

```
Quote source
```

Output:

```
Quote source (http://pleasestopbeingsad.tumblr.com/)

```

Input:

```

    You're a good person
    Don't be too hard on yourself
    Enjoy the little things

```

Output:

```
* You're a good person
* Don't be too hard on yourself
* Enjoy the little things

```

Input:

```
Tomorrow will be better.
You're doing your best, and I'm proud of you.
```

Output:

```
Tomorrow will be better.

You're doing your best, and I'm proud of you.

```

Input:

```
It's always good to read a good book.
You are not here, but I am thinking of you.
```

Output:

```
It's always good to read a good book. You are not here, but I am thinking of you.

```

Input:

```

    If she wants to dance and drink all night.

        Well theres no one that can stop her
        Shes going until the house lights come up or her stomach spills on to the floor
        This night is gonna end when we're damn well ready for it to be over
        Worked all week long now the music is playing on our time

    HelloFin.

```

Output

```
If she wants to dance and drink all night.

* Well theres no one that can stop her
* Shes going until the house lights come up or her stomach spills on to the floor
* This night is gonna end when we're damn well ready for it to be over
* Worked all week long now the music is playing on our time

Hello

Fin.

```

Related
-------

[](#related)

- [Twig Extension](https://github.com/PurpleBooth/twig-htmlstrip)

Versioning
----------

[](#versioning)

We use [semver](http://semver.org/). See the [releases](https://github.com/PurpleBooth/htmlstrip/releases) for a changelog and versions

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 92% 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 ~133 days

Total

4

Last Release

3175d ago

Major Versions

v0.1.0 → v1.0.02016-07-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/25c07c3e1106894ada5c64a88d9efe13c25e5529775928d75c63e8fb94b600d3?d=identicon)[PurpleBooth](/maintainers/PurpleBooth)

---

Top Contributors

[![PurpleBooth](https://avatars.githubusercontent.com/u/133327?v=4)](https://github.com/PurpleBooth "PurpleBooth (23 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")[![jeffreymb](https://avatars.githubusercontent.com/u/770797?v=4)](https://github.com/jeffreymb "jeffreymb (1 commits)")

### Embed Badge

![Health badge](/badges/purplebooth-htmlstrip/health.svg)

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

###  Alternatives

[abelzhou/php-trie-tree

Make a trie tree with php language.

21717.9k1](/packages/abelzhou-php-trie-tree)[doublesecretagency/craft-spoon

Bend your Matrix fields with block groups &amp; tabs.

8225.6k](/packages/doublesecretagency-craft-spoon)[robotusers/cakephp-excel

Robotusers CakePHP Excel plugin

2312.1k](/packages/robotusers-cakephp-excel)[plenta/contao-jobs-basic-bundle

Basic Job Manager for Contao (including Google Jobs).

335.1k](/packages/plenta-contao-jobs-basic-bundle)[timwassenburg/filament-timesheets

Filament Timesheets is a package for Filament that allows you to track time spent on projects and tasks.

471.1k1](/packages/timwassenburg-filament-timesheets)

PHPackages © 2026

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