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

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

kranemora/html2text
===================

Html to text converter

v1.0.0(6y ago)34.7k↓50%[1 issues](https://github.com/kranemora/html2text/issues)MITPHPPHP &gt;=5.3.0

Since Aug 28Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

Html to Text Converter
======================

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

Convert HTML documents to plain text.

Installing
----------

[](#installing)

```
composer require kranemora/html2text

```

Basic Usage
-----------

[](#basic-usage)

```
$html =  [
        'break' => '',
        'prepend' => '[',
        'append' => ']',
        'between' => ', '
    ]
];

$html2Text = new \kranemora\Html2Text\Html2Text;
$html2Text->setDefaultOptions($options);
$text = $html2Text->convert($html);
```

Output:

```
[Ultrices magna vitae], [Gravida velit], [Nunc lobortis], [Tortor nec auctor ultricies]
[Tortor nec auctor ultricies], [Nunc lobortis], [Gravida velit], [Ultrices magna vitae]

```

### Custom Parser

[](#custom-parser)

./src/Parsers/OlParser.php

```
