2017 © Pedro Peláez
 

library inlinestyle

Apply CSS stylesheets directly as inline styles to a HTML document

image

inlinestyle/inlinestyle

Apply CSS stylesheets directly as inline styles to a HTML document

  • Friday, May 4, 2018
  • by christiaan
  • Repository
  • 12 Watchers
  • 129 Stars
  • 173,690 Installations
  • PHP
  • 10 Dependents
  • 1 Suggesters
  • 28 Forks
  • 9 Open issues
  • 12 Versions
  • 5 % Grown

The README.md

InlineStyle

Build Status Scrutinizer Quality Score, (*1)

InlineStyle provides an easy way to apply embedded and external stylesheets directly as inline styles on the HTML tags. This is especially targetted at mail clients which mostly dont support stylesheets but do support the style attribute for HTML tags., (*2)

Installation

Run composer.phar require inlinestyle/inlinestyle Or add the following to your composer.json file "require": { "inlinestyle/inlinestyle": "1.*" }, (*3)

Usage

Use composer to download required dependencies., (*4)

Import InlineStyle, (*5)

use \InlineStyle\InlineStyle;

Create a new InlineStyle object from either a HTML string or HTML file., (*6)

$htmldoc = new InlineStyle("testfiles/test.html");

or, (*7)

$htmldoc = new InlineStyle(file_get_contents("http://github.com"));

Apply the embedded and external stylesheets

First we'll have to extract the stylesheets from the document and then we have to apply them., (*8)

$htmldoc->applyStylesheet($htmldoc->extractStylesheets());

The second param is the base url that is used to parse the links to external stylesheets., (*9)

$htmldoc->applyStylesheet($htmldoc->extractStylesheets(null, "http://github.com"));

Applying additional stylesheets

This class can also be used to apply a given css template to each processed HTML file., (*10)

$htmldoc->applyStylesheet(file_get_contents("testfiles/external.css"));

Retrieving the modified HTML

After calling applyStylesheet various times the resulting HTML can be retrieved as a string using getHTML., (*11)

$html = $htmldoc->getHTML();

The Versions

04/05 2018

dev-master

9999999-dev

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Tibben
by Christiaan Baartse

email css inline

13/12 2015

1.2.7

1.2.7.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Tibben
by Christiaan Baartse

email css inline

11/12 2015

1.2.6

1.2.6.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Tibben
by Christiaan Baartse

email css inline

16/08 2015

dev-rewrite

dev-rewrite

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Tibben
by Christiaan Baartse

email css inline

21/05 2014

1.2.5

1.2.5.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

The Development Requires

by Michael Tibben
by Christiaan Baartse

email css inline

23/03 2014

1.2.4

1.2.4.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse

28/01 2014

1.2.3

1.2.3.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse

16/01 2014

1.2.2

1.2.2.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse

17/12 2013

1.2.1

1.2.1.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse

11/12 2013

1.2.0

1.2.0.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse

15/04 2013

1.0.1

1.0.1.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse

10/09 2012

1.0.0

1.0.0.0

Apply CSS stylesheets directly as inline styles to a HTML document

  Sources   Download

MIT

The Requires

 

by Michael Tibben
by Christiaan Baartse