PHPackages                             joshuataylor/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. [Templating &amp; Views](/categories/templating)
4. /
5. joshuataylor/to-inline-style-email-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

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

A Symfony2 bundle for using the CssToInlineStyles translator by tijsverkoyen, this is a custom patched repository.

08PHP

Since Oct 13Pushed 11y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#toinlinestyleemailbundle)

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

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

[](#requirements)

**ToInlineStyleEmailBundle** is only supported on **PHP 5.3.3** 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": {
    "robertotru/to-inline-style-email-bundle": "dev-master"
},

```

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

```
new JoshTaylor\ToInlineStyleEmailBundle\JoshTaylorToInlineStyleEmailBundle(),
```

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

$converter->setHTML($html);
$converter->setCSS($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',
   array('param_1'=>$val_of_param_1, ..., 'param_n'=>$val_of_param_n));
```

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

You can use inline css directly in Twig template:

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

...

{% endinlinecss }
```

Paths relative to bundle are supported as well:

```
{% inlinecss '@AcmeBundle:css:email.css' %}

...

{% endinlinecss }
```

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

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

[](#contributing)

**ToInlineStyleEmailBundle** is an open source project. 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 and is maintained by Roberto Trunfio (see more on the author at [www.trunfio.it](http://www.trunfio.it))

This unofficial branch is maintained by Josh Taylor until fixes are pushed upstream by the original author.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.4% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7bf2af0c32439aa5c7ca663a112c48ebf868487e3ff871a14118b213926e6a39?d=identicon)[joshtaylor](/maintainers/joshtaylor)

---

Top Contributors

[![robertotru](https://avatars.githubusercontent.com/u/2987914?v=4)](https://github.com/robertotru "robertotru (26 commits)")[![mente](https://avatars.githubusercontent.com/u/391997?v=4)](https://github.com/mente "mente (10 commits)")[![joshuataylor](https://avatars.githubusercontent.com/u/225131?v=4)](https://github.com/joshuataylor "joshuataylor (2 commits)")

### Embed Badge

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

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

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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