src/Mime/Message.php
public static function stripTags($html, $charset = 'UTF-8')
    {
        $patterns = [
            '~<(style|script|head).*</\\1>~Uis' => '',
            '~<t[dh][ >]~i' => ' $0',
            '~<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>~is' => '$2 &lt;$1&gt;',
            '~[\r\n ]+~' => ' ',
            '~<(/?p|/?h\d|li|br|/tr)[ >/]~i' => "\n$0",
        ];

        $text = preg_replace(array_keys($patterns), array_values($patterns), $html);
        $text = html_entity_decode(strip_tags($text), ENT_QUOTES, $charset);
        $text = preg_replace('~[ \t]+~', ' ', $text);
        return trim($text);
    }
public static function stripTags($html, $charset = 'UTF-8')
    {
        $patterns = [
            '~<(style|script|head).*</\\1>~Uis' => '',
            '~<t[dh][ >]~i' => ' $0',
            '~<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>~is' => '$2 &lt;$1&gt;',
            '~[\r\n ]+~' => ' ',
            '~<(/?p|/?h\d|li|br|/tr)[ >/]~i' => "\n$0",
        ];

        $text = preg_replace(array_keys($patterns), array_values($patterns), $html);
        $text = html_entity_decode(strip_tags($text), ENT_QUOTES, $charset);
        $text = preg_replace('~[ \t]+~', ' ', $text);
        return trim($text);
    }
public static function stripTags ( $ html , $ charset = 'UTF-8' ) { $ patterns = [ '~<(style|script|head).*</\\1>~Uis' => '' , '~<t[dh][ >]~i' => ' $0' , '~<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>~is' => '$2 &lt;$1&gt;' , '~[\r\n ]+~' => ' ' , '~<(/?p|/?h\d|li|br|/tr)[ >/]~i' => "\n$0" , ] ; $ text = preg_replace ( array_keys ( $ patterns ) , array_values ( $ patterns ) , $ html ) ; $ text = html_entity_decode ( strip_tags ( $ text ) , ENT_QUOTES , $ charset ) ; $ text = preg_replace ( '~[ \t]+~' , ' ' , $ text ) ; return trim ( $ text ) ; }
Strip HTML tags

@param  string $html The html content
@return string
Strip HTML tags