1441 |
ariadna |
1 |
# Html2Text
|
|
|
2 |
|
|
|
3 |
A PHP library for converting HTML to formatted plain text.
|
|
|
4 |
|
|
|
5 |
[](https://github.com/mtibben/html2text/actions/workflows/ci.yml)
|
|
|
6 |
|
|
|
7 |
## Installing
|
|
|
8 |
|
|
|
9 |
```
|
|
|
10 |
composer require html2text/html2text
|
|
|
11 |
```
|
|
|
12 |
|
|
|
13 |
## Basic Usage
|
|
|
14 |
```php
|
|
|
15 |
$html = new \Html2Text\Html2Text('Hello, "<b>world</b>"');
|
|
|
16 |
|
|
|
17 |
echo $html->getText(); // Hello, "WORLD"
|
|
|
18 |
```
|
|
|
19 |
|
|
|
20 |
## History
|
|
|
21 |
|
|
|
22 |
This library started life on the blog of Jon Abernathy http://www.chuggnutt.com/html2text
|
|
|
23 |
|
|
|
24 |
A number of projects picked up the library and started using it - among those was RoundCube mail. They made a number of updates to it over time to suit their webmail client.
|
|
|
25 |
|
|
|
26 |
Now it has been extracted as a standalone library. Hopefully it can be of use to others.
|