New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

adamlc/premailer-cli-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adamlc/premailer-cli-wrapper

PHP CLI wrapper for Premailer (https://github.com/premailer/premailer)

Source
Packagist
Version
0.0.4
Version published
Total downloads
18K
Maintainers
1
Created
Source

Premailer CLI Wrapper

This library is a PHP CLI wrapper for Premailer. Premailer is a tool to inline all of your CSS to ensure best compatibility with email clients.

Premailer is written in Ruby, but can be accessed via a CLI. You will first need to install the Rubygem:

sudo gem install premailer

Install via Composer

To install AddressFormat as a Composer package add this to your composer.json:

"adamlc/premailer-cli-wrapper": "dev-master"

Run composer update

Usage Instructions

WARNING! This library currently doesn't have any unit tests and very much error checking. It will develop over time as I begin to use it in Production.

<?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();

Thats pretty much it!

##TODO

  • Write some unit tests.
  • Error checking / Exceptions
  • Use filesystem abstraction library
  • Additional Premailer options. Such as remove scripts etc

FAQs

Package last updated on 03 Nov 2014

Related posts