PHPackages                             jakubpolok/css-to-inline-styles - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. jakubpolok/css-to-inline-styles

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

jakubpolok/css-to-inline-styles
===============================

Only a Fork of -&gt; CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

v1.0.1(1y ago)09BSD-3-ClausePHPPHP &gt;=8.4.0

Since Mar 28Pushed 1y agoCompare

[ Source](https://github.com/jakubpolok/CssToInlineStyles)[ Packagist](https://packagist.org/packages/jakubpolok/css-to-inline-styles)[ Docs](https://github.com/voku/CssToInlineStyles)[ RSS](/packages/jakubpolok-css-to-inline-styles/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

[![Build Status](https://camo.githubusercontent.com/439de46fcc9b15b1a43a77c9bb10bf6d7e7e6136f5329184e943b93adee1683f/68747470733a2f2f7472617669732d63692e6f72672f766f6b752f437373546f496e6c696e655374796c65732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/voku/CssToInlineStyles)[![codecov.io](https://camo.githubusercontent.com/cbfcd7a670cd79fbd2592cda409a35cad179bfe030970f9628a86cf98c0d1879/687474703a2f2f636f6465636f762e696f2f6769746875622f766f6b752f437373546f496e6c696e655374796c65732f636f7665726167652e7376673f6272616e63683d6d6173746572)](http://codecov.io/github/voku/CssToInlineStyles?branch=master)[![Coverage Status](https://camo.githubusercontent.com/637f271b25d09f4fe8796c5e553d42a241a4f7a82512903a3fe9361b05f1514e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f766f6b752f437373546f496e6c696e655374796c65732f62616467652e737667)](https://coveralls.io/r/voku/CssToInlineStyles)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/79b175e46e4056def6bba4e1f611ba5f2ec3298acae466c53e06b5cfa6c93eae/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f766f6b752f437373546f496e6c696e655374796c65732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/voku/CssToInlineStyles/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/f733222dc437a58153873abf0f23b345f67593ca5ed870c253eb623c2799b0f1/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3437636161333834663339303437326362666631663164343663383666643865)](https://www.codacy.com/app/voku/CssToInlineStyles)[![SensioLabsInsight](https://camo.githubusercontent.com/d00b4a5f6085afdfc6e6caedc320519f60daf446f393073778588cac070e6e9f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f32343638653732652d646339312d346331362d393235392d3230633565326330643261392f6d696e692e706e67)](https://insight.sensiolabs.com/projects/2468e72e-dc91-4c16-9259-20c5e2c0d2a9)[![Latest Stable Version](https://camo.githubusercontent.com/3a9fc720c4c0e0743838b103b3f64a5bd97e3a399bc121d3947750100521afd5/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6373732d746f2d696e6c696e652d7374796c65732f762f737461626c65)](https://packagist.org/packages/voku/css-to-inline-styles)[![Total Downloads](https://camo.githubusercontent.com/ea30f33656ecb13a53fe33c5dd435b6f173cd9fd6218bfc578358bfcda6d69ab/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6373732d746f2d696e6c696e652d7374796c65732f646f776e6c6f616473)](https://packagist.org/packages/voku/css-to-inline-styles)[![Latest Unstable Version](https://camo.githubusercontent.com/32a74347330526c13b77aeda7184b9f3d1c1602ec35f9bdc2369f74ca7796819/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6373732d746f2d696e6c696e652d7374796c65732f762f756e737461626c65)](https://packagist.org/packages/voku/css-to-inline-styles)[![PHP 7 ready](https://camo.githubusercontent.com/59a3669736f6c2b286409389418e24463f8c6b6b1363622c465b3414e10c7e3c/687474703a2f2f7068703772656164792e74696d6573706c696e7465722e63682f766f6b752f437373546f496e6c696e655374796c65732f62616467652e737667)](https://travis-ci.org/voku/CssToInlineStyles)[![License](https://camo.githubusercontent.com/d88415a512541b572f72ac9dfbd9742d204f81dfd4d4d6930a8a8f00096bb2ba/68747470733a2f2f706f7365722e707567782e6f72672f766f6b752f6373732d746f2d696e6c696e652d7374796c65732f6c6963656e7365)](https://packagist.org/packages/voku/css-to-inline-styles)

CssToInlineStyles class
=======================

[](#csstoinlinestyles-class)

WARNING: this is only a Extended-Fork of ""

> CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.

About
-----

[](#about)

PHP CssToInlineStyles is a class to convert HTML into HTML with inline styles.

Installation
------------

[](#installation)

The recommended installation way is through [Composer](https://getcomposer.org).

```
$ composer require voku/css-to-inline-styles
```

Example
-------

[](#example)

```
use voku\CssToInlineStyles\CssToInlineStyles;

// Convert HTML + CSS to HTML with inlined CSS
$cssToInlineStyles= new CssToInlineStyles();
$cssToInlineStyles->setHTML($html);
$cssToInlineStyles->setCSS($css);
$html = $cssToInlineStyles->convert();

// Or use inline-styles blocks from the HTML as CSS
$cssToInlineStyles = new CssToInlineStyles($html);
$cssToInlineStyles->setUseInlineStylesBlock(true);
$html = $cssToInlineStyles->convert();

// Or use linked files from the HTML as CSS
$cssToInlineStyles = new CssToInlineStyles($html);
$cssToInlineStyles->setLoadCSSFromHTML(true);
$html = $cssToInlineStyles->convert(false, 0, __DIR__ . '/../tests/');

```

Documentation
-------------

[](#documentation)

The following properties exists and have set methods available:

PropertyDefaultDescriptioncleanupfalseShould the generated HTML be cleaned?useInlineStylesBlockfalseUse inline-styles block as CSS.stripOriginalStyleTagsfalseStrip original style tags.excludeMediaQueriestrueExclude media queries from extra "css" and keep media queries for inline-styles blocks.excludeConditionalInlineStylesBlocktrueExclude conditional inline-style blocks.Warning
-------

[](#warning)

Also if the default is `cleanup === false`, you maybe need to use this feature, because Outlook has some special features where the inline-CSS will be ignored and it will fallback to use only the CSS-Class- or ID-properties.

```
$cssToInlineStyles->setCleanup(true);
```

Known issues
------------

[](#known-issues)

- no support for pseudo selectors

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance49

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

407d ago

PHP version history (2 changes)v1.0.0PHP &gt;=7.0.0

v1.0.1PHP &gt;=8.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc1a33933c2305d1cd70b079420415e04758eba36573c834cfbff83839d92e7f?d=identicon)[jakubpolok](/maintainers/jakubpolok)

---

Top Contributors

[![tijsverkoyen](https://avatars.githubusercontent.com/u/250042?v=4)](https://github.com/tijsverkoyen "tijsverkoyen (85 commits)")[![voku](https://avatars.githubusercontent.com/u/264695?v=4)](https://github.com/voku "voku (83 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (14 commits)")[![stof](https://avatars.githubusercontent.com/u/439401?v=4)](https://github.com/stof "stof (8 commits)")[![jbboehr](https://avatars.githubusercontent.com/u/225601?v=4)](https://github.com/jbboehr "jbboehr (4 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (4 commits)")[![jakubpolok](https://avatars.githubusercontent.com/u/123940114?v=4)](https://github.com/jakubpolok "jakubpolok (3 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![tzsk](https://avatars.githubusercontent.com/u/13273787?v=4)](https://github.com/tzsk "tzsk (2 commits)")[![gigatribedev](https://avatars.githubusercontent.com/u/247793987?v=4)](https://github.com/gigatribedev "gigatribedev (1 commits)")[![brandomeniconi](https://avatars.githubusercontent.com/u/393114?v=4)](https://github.com/brandomeniconi "brandomeniconi (1 commits)")[![jasonwain](https://avatars.githubusercontent.com/u/1015436?v=4)](https://github.com/jasonwain "jasonwain (1 commits)")[![lifo101](https://avatars.githubusercontent.com/u/367337?v=4)](https://github.com/lifo101 "lifo101 (1 commits)")[![marclaporte](https://avatars.githubusercontent.com/u/1004261?v=4)](https://github.com/marclaporte "marclaporte (1 commits)")[![theluk](https://avatars.githubusercontent.com/u/580946?v=4)](https://github.com/theluk "theluk (1 commits)")[![dmaicher](https://avatars.githubusercontent.com/u/921145?v=4)](https://github.com/dmaicher "dmaicher (1 commits)")

---

Tags

cssstyleemailinlinecss-to-htmlCSSToHtmlCSSinline

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jakubpolok-css-to-inline-styles/health.svg)

```
[![Health](https://phpackages.com/badges/jakubpolok-css-to-inline-styles/health.svg)](https://phpackages.com/packages/jakubpolok-css-to-inline-styles)
```

###  Alternatives

[voku/css-to-inline-styles

Only a Fork of -&gt; CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.

20252.5k2](/packages/voku-css-to-inline-styles)[egulias/email-validator

A library for validating emails against several RFCs

11.6k691.3M307](/packages/egulias-email-validator)[pelago/emogrifier

Converts CSS styles into inline style attributes in your HTML code

94944.1M108](/packages/pelago-emogrifier)[inlinestyle/inlinestyle

Apply CSS stylesheets directly as inline styles to a HTML document

140635.8k8](/packages/inlinestyle-inlinestyle)[robertotru/to-inline-style-email-bundle

A Symfony2 bundle for using the CssToInlineStyles translator by tijsverkoyen

59384.3k](/packages/robertotru-to-inline-style-email-bundle)[gushphp/to-inline-style-email-bundle

A Symfony2 bundle for using the CssToInlineStyles translator by tijsverkoyen

59311.5k](/packages/gushphp-to-inline-style-email-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
