purplebooth/htmlstrip

此包已被废弃,不再维护。没有建议的替代包。

将一小部分 HTML 转换为合理的内容,可以用于纯文本电子邮件或 SMS。

1.0.2 2017-08-29 16:21 UTC

README

一个将一小部分 HTML 转换为合理内容的类,可用于纯文本电子邮件或 SMS。

Build Status Scrutinizer Code Quality Coverage Status Dependency Status Latest Stable Version Total Downloads License

如何使用

将依赖项添加到您的 composer.json 文件中

php composer.phar require purplebooth/htmlstrip:^1.0.0

然后使用它!

$htmlStripper = new PurpleBooth\HtmlStripperImplementation();
$htmlStripper->("<p>Hello, world.</p>")
// -> "Hello, world."

建议您在类型检查时依赖我们的接口

use PurpleBooth\HtmlStripper;

class YourClass
{

    public function __construct(HtmlStripper $htmlStrip)
    {
        ... etc ...

示例

输入

<p>Hello, world.</p>

输出

Hello, world.

输入

<a href="http://pleasestopbeingsad.tumblr.com/">Quote source</a>

输出

Quote source (http://pleasestopbeingsad.tumblr.com/)

输入

<ul>
    <li>You're a good person</li>
    <li>Don't be too hard on yourself</li>
    <li>Enjoy the little things</li>
</ul>

输出

* You're a good person
* Don't be too hard on yourself
* Enjoy the little things

输入

<div>Tomorrow will be better.</div>
You're doing your best, and I'm proud of you.

输出

Tomorrow will be better.


You're doing your best, and I'm proud of you.

输入

<blockquote>It's always good to read a good book.</blockquote>
You are not here, <i>but I am thinking of you.</i>

输出

It's always good to read a good book. You are not here, but I am thinking of you.

输入

<div>
    <p>If she wants to <i>dance</i> and drink all night.</p>
    <ul>
        <li>Well theres no one that can stop her</li>
        <li>Shes going until the house lights come up or her stomach spills on to the floor</li>
        <li>This night is gonna end when we're damn well ready for it to be over</li>
        <li>Worked all week long now the music is playing on our time</li>
    </ul>
    <div><div>Hello</div><div>Fin.</div></div>
</div>

输出

If she wants to dance and drink all night.

* Well theres no one that can stop her
* Shes going until the house lights come up or her stomach spills on to the floor
* This night is gonna end when we're damn well ready for it to be over
* Worked all week long now the music is playing on our time


Hello


Fin.

相关

版本控制

我们使用 semver。查看 发布 以获取变更日志和版本信息。