2017 © Pedro Peláez
 

library html2text

Only a Fork of -> html2text: Converts HTML to formatted plain text

image

voku/html2text

Only a Fork of -> html2text: Converts HTML to formatted plain text

  • Saturday, May 5, 2018
  • by voku
  • Repository
  • 4 Watchers
  • 18 Stars
  • 26,125 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 118 Forks
  • 3 Open issues
  • 50 Versions
  • 10 % Grown

The README.md

Build Status Coverage Status Codacy Badge Latest Stable Version Total Downloads License Donate to this project using Paypal Donate to this project using Patreon, (*1)

:memo: Html2Text

Description

Convert HTML to formatted plain text, e.g. for text mails., (*2)

Installation

The recommended installation way is through Composer., (*3)

$ composer require voku/html2text

Basic Usage

$html = new \voku\Html2Text\Html2Text('Hello, &quot;<b>world</b>&quot;');

echo $html->getText();  // Hello, "WORLD"

Extended Usage

Each element (h1, li, div, etc) can have the following options:, (*4)

  • 'case' => convert case (Html2Text::OPTION_NONE, Html2Text::OPTION_UPPERCASE, Html2Text::OPTION_LOWERCASE , Html2Text::OPTION_UCFIRST, Html2Text::OPTION_TITLE)
  • 'prepend' => prepend a string
  • 'append' => append a string

For example:, (*5)

$html = '

Should have "AAA" changed to BBB

  • • Custom bullet should be removed
<img alt="The Linux Tux" src="tux.png" />'; $expected = 'SHOULD HAVE "BBB" CHANGED TO BBB' . "\n\n" . '- Custom bullet should be removed |' . "\n\n" . '[IMAGE]: "The Linux Tux"'; $html2text = new Html2Text( $html, array( 'width' => 0, 'elements' => array( 'h1' => array( 'case' => Html2Text::OPTION_UPPERCASE, 'replace' => array('AAA', 'BBB')), 'li' => array( 'case' => Html2Text::OPTION_NONE, 'replace' => array('•', ''), 'prepend' => "- ", 'append' => " |", ), ), ) ); $html2text->setPrefixForImages('[IMAGE]: '); $html2text->setPrefixForLinks('[LINKS]: '); $html2text->getText(); // === $expected

Live Demo

  • HTML | TEXT, (*6)

  • https://moelleken.org/url_to_text.php?url=https://ADD_YOUR_URL_HERE, (*7)

History

This library started life on the blog of Jon Abernathy http://www.chuggnutt.com/html2text, (*8)

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., (*9)

Now this is a extend fork of the original Html2Text., (*10)

Support

For support and donations please visit Github | Issues | PayPal | Patreon., (*11)

For status updates and release announcements please visit Releases | Twitter | Patreon., (*12)

For professional support please contact me., (*13)

Thanks

  • Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
  • Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  • Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
  • Thanks to StyleCI for the simple but powerfull code style check.
  • Thanks to PHPStan && Psalm for relly great Static analysis tools and for discover bugs in the code!

The Versions

05/05 2018

dev-master

9999999-dev

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

23/12 2017

5.0.0

5.0.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

19/11 2017

4.0.0

4.0.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

29/08 2017

3.4.12

3.4.12.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/05 2017

3.4.11

3.4.11.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

17/10 2016

3.4.10

3.4.10.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

17/10 2016

3.4.9

3.4.9.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/08 2016

dev-analysis-qg0Ekk

dev-analysis-qg0Ekk

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/08 2016

3.4.8

3.4.8.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

19/08 2016

3.4.7

3.4.7.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

12/08 2016

3.4.5

3.4.5.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

12/08 2016

3.4.6

3.4.6.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

12/08 2016

3.4.4

3.4.4.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

03/08 2016

3.4.3

3.4.3.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

01/08 2016

3.4.2

3.4.2.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

01/08 2016

dev-analysis-8nekBA

dev-analysis-8nekBA

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

05/07 2016

3.4.1

3.4.1.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

05/07 2016

3.4.0

3.4.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

04/07 2016

3.3.0

3.3.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

04/07 2016

3.2.2

3.2.2.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

04/07 2016

3.2.1

3.2.1.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

30/06 2016

3.2.0

3.2.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

22/06 2016

3.1.20

3.1.20.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

22/06 2016

3.1.19

3.1.19.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

22/06 2016

3.1.18

3.1.18.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/06 2016

3.1.17

3.1.17.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/06 2016

3.1.16

3.1.16.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/06 2016

3.1.15

3.1.15.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

26/04 2016

3.1.14

3.1.14.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

31/03 2016

3.1.13

3.1.13.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/03 2016

3.1.12

3.1.12.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

23/12 2015

3.1.11

3.1.11.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

14/10 2015

3.1.10

3.1.10.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

13/10 2015

3.1.9

3.1.9.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

11/10 2015

3.1.8

3.1.8.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/09 2015

3.1.7

3.1.7.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

17/09 2015

3.1.6

3.1.6.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

07/09 2015

3.1.5

3.1.5.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

19/08 2015

3.1.4

3.1.4.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/07 2015

3.1.3

3.1.3.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

21/07 2015

3.1.2

3.1.2.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

20/07 2015

3.1.1

3.1.1.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

17/07 2015

3.1.0

3.1.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

16/07 2015

3.0.1

3.0.1.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

16/07 2015

3.0.0

3.0.0.0

Only a Fork of -> html2text: Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Requires

 

The Development Requires

email html text htmltotext html-to-text htmlintotext

29/01 2015

2.0.1

2.0.1.0

Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Development Requires

18/10 2014

2.0.0

2.0.0.0

Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Development Requires

06/06 2014

1.0.1

1.0.1.0

Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Development Requires

26/12 2013

1.0.0

1.0.0.0

Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Development Requires

10/10 2013

dev-features/rc-formatting

dev-features/rc-formatting

Converts HTML to formatted plain text

  Sources   Download

GPLv2

The Development Requires