Download the PHP package hocvt/emogrifier without Composer

On this page you can find all versions of the php package hocvt/emogrifier. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package emogrifier

Emogrifier

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

n. e•mog•ri•fi•er [\ē-'mä-grƏ-,fī-Ər] - a utility for changing completely the nature or appearance of HTML email, esp. in a particularly fantastic or bizarre manner

Emogrifier converts CSS styles into inline style attributes in your HTML code. This ensures proper display on email and mobile device readers that lack stylesheet support.

This utility was developed as part of Intervals to deal with the problems posed by certain email clients (namely Outlook 2007 and GoogleMail) when it comes to the way they handle styling contained in HTML emails. As many web developers and designers already know, certain email clients are notorious for their lack of CSS support. While attempts are being made to develop common email standards, implementation is still a ways off.

The primary problem with uncooperative email clients is that most tend to only regard inline CSS, discarding all <style> elements and links to stylesheets in <link> elements. Emogrifier solves this problem by converting CSS styles into inline style attributes in your HTML code.

How it Works

Emogrifier automagically transmogrifies your HTML by parsing your CSS and inserting your CSS definitions into tags within your HTML based on your CSS selectors.

Installation

For installing emogrifier, either add pelago/emogrifier to your project's composer.json, or you can use composer as below:

Usage

First, you provide Emogrifier with the HTML and CSS you would like to merge. This can happen directly during instantiation:

$html = '<html><h1>Hello world!</h1></html>';
$css = 'h1 {font-size: 32px;}';
$emogrifier = new \Pelago\Emogrifier($html, $css);

You could also use the setters for providing this data after instantiation:

$emogrifier = new \Pelago\Emogrifier();

$html = '<html><h1>Hello world!</h1></html>';
$css = 'h1 {font-size: 32px;}';

$emogrifier->setHtml($html);
$emogrifier->setCss($css);

After you have set the HTML and CSS, you can call the emogrify method to merge both:

$mergedHtml = $emogrifier->emogrify();

Emogrifier automatically adds a Content-Type meta tag to set the charset for the document (if it is not provided).

If you would like to get back only the content of the BODY element instead of the complete HTML document, you can use the emogrifyBodyContent instead:

$bodyContent = $emogrifier->emogrifyBodyContent();

Options

There are several options that you can set on the Emogrifier object before calling the emogrify method:

Requirements

Installing with Composer

Download the composer.phar locally or install Composer globally:

curl -s https://getcomposer.org/installer | php

Run the following command for a local installation:

php composer.phar require pelago/emogrifier:@dev

Or for a global installation, run the following command:

composer require pelago/emogrifier:@dev

You can also add follow lines to your composer.json and run the composer update command:

"require": {
  "pelago/emogrifier": "@dev"
}

See https://getcomposer.org/ for more information and documentation.

Supported CSS selectors

Emogrifier currently support the following CSS selectors:

The following selectors are not implemented yet:

Caveats

Maintainer

Emogrifier is maintained by the good people at Pelago, info AT pelagodesign DOT com.


All versions of emogrifier with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0, <=7.2.99
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hocvt/emogrifier contains the following files

Loading the files please wait ....