PHPackages                             vysokeskoly/to-inline-style-email-bundle - 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. vysokeskoly/to-inline-style-email-bundle

ActiveSymfony-bundle[Mail &amp; Notifications](/categories/mail)

vysokeskoly/to-inline-style-email-bundle
========================================

A Symfony bundle for using the CssToInlineStyles translator by tijsverkoyen

3.0.1(3y ago)157.6k↓37.5%MITPHPPHP ^8.1

Since Jan 21Pushed 3y agoCompare

[ Source](https://github.com/vysokeskoly/ToInlineStyleEmailBundle)[ Packagist](https://packagist.org/packages/vysokeskoly/to-inline-style-email-bundle)[ Docs](http://github.com/vysokeskoly/ToInlineStyleEmailBundle)[ RSS](/packages/vysokeskoly-to-inline-style-email-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (12)Versions (10)Used By (0)

ToInlineStyleEmailBundle
========================

[](#toinlinestyleemailbundle)

[![Latest Stable Version](https://camo.githubusercontent.com/1a25efe806d62e7692a092ee73b75127379bbfa860124531f8bba2690f895aba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7679736f6b65736b6f6c792f746f2d696e6c696e652d7374796c652d656d61696c2d62756e646c652e737667)](https://packagist.org/packages/vysokeskoly/to-inline-style-email-bundle)[![License](https://camo.githubusercontent.com/eec9ed19ec7d58cc0b7f79de0e5922fdd70716f9bce31b0e6f12f69f758255fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7679736f6b65736b6f6c792f746f2d696e6c696e652d7374796c652d656d61696c2d62756e646c652e737667)](https://packagist.org/packages/vysokeskoly/to-inline-style-email-bundle)[![PHP - Checks](https://github.com/vysokeskoly/ToInlineStyleEmailBundle/actions/workflows/php-checks.yaml/badge.svg)](https://github.com/vysokeskoly/ToInlineStyleEmailBundle/actions/workflows/php-checks.yaml)

**ToInlineStyleEmailBundle** is a *Symfony2* bundle to use the **CssToInlineStyles** translator by *Tijs Verkoyen* (see  for the repository)

Requirements
============

[](#requirements)

**ToInlineStyleEmailBundle** is only supported on **PHP 8.1** and up.

Installation
============

[](#installation)

Please, use the *Composer* to install this bundle in your Symfony2 app.

The following lines should be added in your `composer.json`

```
"require": {
    "vysokeskoly/to-inline-style-email-bundle": "^3.0"
},
```

Then, register the bundle in your AppKernel by adding the following line:

```
    VysokeSkoly\ToInlineStyleEmailBundle\ToInlineStyleEmailBundle::class => ['all' => true],
```

Documentation and Examples
==========================

[](#documentation-and-examples)

The bundle provides a service named **css\_to\_inline\_email\_converter**. Use it in a controller to have a nice shortcut to the converter developed by *Tijs Verkoyen*. E.g.:

```
public function indexAction() {
    $converter = $this->get('css_to_inline_email_converter');
    ...
}
```

Get the HTML and the CSS as a string and set this required values to the converter object, e.g.

```
$converter = $this->get('css_to_inline_email_converter');

$html = ...; // get the HTML here
$css = ....; // get the CSS here

return $converter->inlineCSS($html, $css);
```

The retrieval of the HTML and CSS files from its folder it is only up-to you. E.g. in your controller retrieve the content of your CSS as:

```
file_get_contents($this->container->getParameter('kernel.root_dir').'/../src/Acme/TestBundle/Resources/css/mystyle.css');
```

Of course, it is supposed that a Symfony user will use a template instead of a static HTML page. Hence, for convenience, the service provides a function capable to render a template. E.g.:

```
$converter->setHTMLByView(
    'AcmeTestBundle:MyController:my_template.html.twig',
    [
        'param_1' => $val_of_param_1,
        // ...,
        'param_n' => $val_of_param_n
    ]
);
```

The preceding function must be used *in vece* of function `setHTML()`.

To use the `generateStyledHTML` method just use it like:

```
$converter->setHtml($html);
$converter->setCss($css);
return $converter->generateStyledHTML();
```

You can use inline css directly in Twig template:

```
{% inlinecss '/css/email.css' %}

...

{% endinlinecss %}
```

Paths relative to bundle are supported as well:

```
{% inlinecss '@AppBundle/Resources/css/email.css' %}

...

{% endinlinecss %}
```

Dynamic variable is supported (Use absolute path with variable with asset or directly with full path to file)

```
{% set path = asset('css/email.css', null, true) %}
{% inlinecss path %}

...

{% endinlinecss %}
```

Dynamic variable is supported (Use absolute path with variable with asset or directly with full path to file)

```
{% set path = asset('css/email.css', null, true) %}
{% inlinecss path %}

...

{% endinlinecss %}
```

Read the docs in the files for further details on the usage of the service.

Contributing
============

[](#contributing)

**ToInlineStyleEmailBundle** is an open source project, under MIT license. Contributions are encouraged. Feel free to contribute to improve this bundle.

About the author of the bundle
==============================

[](#about-the-author-of-the-bundle)

**ToInlineStyleEmailBundle** has been originally developed by Roberto Trunfio. Currently, the bundle is mantained by Luis Cordova via the gushphp organization.

The initial package on packagist robertotru was moved here to gushphp organization with the author consent for maintenance.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity78

Established project with proven stability

 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 ~295 days

Recently: every ~410 days

Total

9

Last Release

1407d ago

Major Versions

1.5.2 → 2.0.02021-05-31

2.0.0 → 3.0.02022-07-11

PHP version history (4 changes)1.2PHP &gt;=5.3.3

1.4.0PHP &gt;=5.5

2.0.0PHP ^7.4

3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bdf0b9957c08a48e70a52fce74fc4f1add30b12d442450d5e2b48854fc98b21?d=identicon)[MortalFlesh](/maintainers/MortalFlesh)

---

Top Contributors

[![robertotru](https://avatars.githubusercontent.com/u/2987914?v=4)](https://github.com/robertotru "robertotru (29 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (27 commits)")[![mente](https://avatars.githubusercontent.com/u/391997?v=4)](https://github.com/mente "mente (10 commits)")[![MortalFlesh](https://avatars.githubusercontent.com/u/6317184?v=4)](https://github.com/MortalFlesh "MortalFlesh (9 commits)")[![Richtermeister](https://avatars.githubusercontent.com/u/624921?v=4)](https://github.com/Richtermeister "Richtermeister (8 commits)")[![kalypso63](https://avatars.githubusercontent.com/u/1765257?v=4)](https://github.com/kalypso63 "kalypso63 (6 commits)")[![OsoianMarcel](https://avatars.githubusercontent.com/u/12122711?v=4)](https://github.com/OsoianMarcel "OsoianMarcel (1 commits)")[![paulandrieux](https://avatars.githubusercontent.com/u/1942078?v=4)](https://github.com/paulandrieux "paulandrieux (1 commits)")[![fernandops26](https://avatars.githubusercontent.com/u/11939055?v=4)](https://github.com/fernandops26 "fernandops26 (1 commits)")[![crussell52](https://avatars.githubusercontent.com/u/375294?v=4)](https://github.com/crussell52 "crussell52 (1 commits)")[![khasinski](https://avatars.githubusercontent.com/u/702380?v=4)](https://github.com/khasinski "khasinski (1 commits)")[![alsar](https://avatars.githubusercontent.com/u/1380676?v=4)](https://github.com/alsar "alsar (1 commits)")

---

Tags

symfonybundlecssstyleemailinline

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/vysokeskoly-to-inline-style-email-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/vysokeskoly-to-inline-style-email-bundle/health.svg)](https://phpackages.com/packages/vysokeskoly-to-inline-style-email-bundle)
```

###  Alternatives

[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)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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