adamlc / premailer-cli-wrapper
用于 Premailer (https://github.com/premailer/premailer) 的 PHP CLI 包装器
0.0.4
2014-11-03 12:50 UTC
Requires
- php: >=5.3.3
- adambrett/shell-wrapper: 0.5.*
This package is not auto-updated.
Last update: 2024-09-14 15:12:09 UTC
README
这个库是一个 PHP CLI 包装器,用于 Premailer。Premailer 是一个工具,可以将所有 CSS 内联,以确保与电子邮件客户端的最佳兼容性。
Premailer是用 Ruby 编写的,但可以通过 CLI 访问。您首先需要安装 Rubygem
sudo gem install premailer
通过 Composer 安装
要将 AddressFormat 作为 Composer 包安装,请将以下内容添加到您的 composer.json 中
"adamlc/premailer-cli-wrapper": "0.0.*"
运行 composer update
使用说明
警告!这个库目前还没有任何单元测试和错误检查。随着我开始在生产环境中使用它,它将不断发展。
<?php use Adamlc\Premailer\Command; use Adamlc\Premailer\Email; //Path to Premailer Binary $command = new Command('/usr/bin/premailer'); //Create a new email instance, passing the Command instance $email = new Email($command); //Set the body of the Email $email->setBody('<h1>Hello world</h1>'); //Get the parsed body of the email $html = $email->getHtml(); $text = $email->getText();
基本上就是这样!
##待办事项
- 编写一些单元测试。
- 错误检查/异常
- 使用文件系统抽象库
- 添加更多 Premailer 选项。例如,删除脚本等