ph-7/html-to-text

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

Fund package maintenance!
pH-7
Ko Fi

v2.0.0 2022-04-25 01:14 UTC

This package is auto-updated.

Last update: 2024-12-11 20:07:26 UTC


README

A simple lightweight "HTML to Plain Text" converter ๐Ÿช„

๐Ÿ“„ Overview

Ko Fi - Offer Me A Coffee

Simple. Clean. Efficient. Just what you need to convert HTML code into plain text ๐Ÿงน

๐Ÿ˜ PHP Requirement

๐Ÿ›  Installation

composer require ph-7/html-to-text

If you don't already use composer in your project, include Composer's autoload as shown below in your main PHP index file of your project.

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

๐Ÿฅณ Usage

use PH7\HtmlToText\Convert;

$htmlCode = '<div><p><em>Some random paragraphs...</em></p></div>';

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

echo $plainText;

๐Ÿ˜‹ Who cooked it?

Pierre-Henry Soria

@phenrysay pH-7

Pierre-Henry Soria. A super passionate, zen & pragmatic software engineer ๐Ÿ˜Š Cheese & dark chocolate lover! ๐Ÿง€๐Ÿซ๐Ÿ˜‹

๏ธโ˜•๏ธ Are you enjoying it...? You could offer me a coffee if you wish ๐Ÿ˜‹

Projects using it ๐Ÿš€

โš–๏ธ License

HTML to Text is generously distributed under MIT ๐ŸŽ‰ Enjoy!