PHPackages                             lanin/laravel-email-templates-optimization - 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. [Framework](/categories/framework)
4. /
5. lanin/laravel-email-templates-optimization

ActiveLibrary[Framework](/categories/framework)

lanin/laravel-email-templates-optimization
==========================================

Optimize your email templates' styles via native Laravel templating mechanism.

0.1.0(9y ago)75.5k[1 issues](https://github.com/mlanin/laravel-email-templates-optimization/issues)MITPHPPHP &gt;=5.5.9

Since Oct 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/mlanin/laravel-email-templates-optimization)[ Packagist](https://packagist.org/packages/lanin/laravel-email-templates-optimization)[ RSS](/packages/lanin-laravel-email-templates-optimization/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Laravel-Email-Templates-Optimization
====================================

[](#laravel-email-templates-optimization)

> Optimize your email templates' styles via native Laravel templating mechanism.

[![Build Status](https://camo.githubusercontent.com/2ecef984b9ea36febd91d43137d0e852b529ccc8f2f84376c11e879ee3fc2969/68747470733a2f2f7472617669732d63692e6f72672f6d6c616e696e2f6c61726176656c2d656d61696c2d74656d706c617465732d6f7074696d697a6174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mlanin/laravel-email-templates-optimization)[![Code Coverage](https://camo.githubusercontent.com/1dbe778ef42255ec3838b3403a6c8b2ce874ebb446396faed826886b752a3bd6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6c616e696e2f6c61726176656c2d656d61696c2d74656d706c617465732d6f7074696d697a6174696f6e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mlanin/laravel-email-templates-optimization/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/133c00af8071a1eabd8bd8d2c30a155ac519baf8315890db769a10a07b2d11c5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d6c616e696e2f6c61726176656c2d656d61696c2d74656d706c617465732d6f7074696d697a6174696f6e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/mlanin/laravel-email-templates-optimization/?branch=master)

If you want to send an HTML email you can't just send it with `` tag in it, or link a stylesheet. Most of the email clients will cut it and clients will see your email without any styles.

The only approach to achieve best email quality is to convert all your styles int inline `style=""` attributes like this:

#### Source

[](#source)

```
>

  Hello World

    body {
      font-size: 14px;
    }
    h1 {
      font-size: 20px;
    }
    a {
      color: #333;
    }

  Hello!

    Laravel

```

#### Result

[](#result)

```
>

  Hello World

  Hello!

    Laravel

```

How to achieve that?
--------------------

[](#how-to-achieve-that)

- You can precompile your templates, and store and send them as is. But your compiled templates will become too hard to maintain.
- Or you can compile them on every email send like in  package. But it will cause an enormous overhead.

With this in mind I made this engine. It compiles css into email templates and at the same time utilises native Laravel's Blade syntax and compile-and-cache approach.

This means that you can store your email templates as before and they will be compiled on the fly and then cached in order not to recompile every time!

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

[](#installation)

[PHP](https://php.net) 5.5.9+ or [HHVM](http://hhvm.com) 3.3+, [Composer](https://getcomposer.org) and [Laravel](http://laravel.com) 5.1+ are required.

To get the latest version of Laravel-Email-Templates-Optimization, simply install it via composer.

```
$ composer require "lanin/laravel-email-templates-optimization:0.1.*"
```

Once package is installed, you need to register the service provider. Open up `config/app.php` and add the following to the providers key.

```
Lanin\Laravel\EmailTemplatesOptimization\ServiceProvider::class,
```

Usage
-----

[](#usage)

What you have to do is just rename your email templates' files from `*.blade.php` to `*.email.php` and that's it! This Engine will do the rest for you!

Configuration
-------------

[](#configuration)

Furthermore you can tell the engine what static css files to use with your templates to not duplicate them in each of them.

For this you set copy this into your view.php config:

```
    'emails' => [
        /*
        |--------------------------------------------------------------------------
        | Css Files
        |--------------------------------------------------------------------------
        |
        | List of absolute paths to static css files to use in your email templates.
        |
        | Example: realpath(resource_path('assets/css/emails.css'))
        |
        */
        'css_files' => [

        ],
    ],
```

Contributing
------------

[](#contributing)

Please feel free to fork this package and contribute by submitting a pull request to enhance the functionalities.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3496d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/968784dc2366d12ce2bd6e0b7beaa7ab3cd65ae526401f7840c057c51f5687fe?d=identicon)[lanin](/maintainers/lanin)

---

Top Contributors

[![mlanin](https://avatars.githubusercontent.com/u/467159?v=4)](https://github.com/mlanin "mlanin (17 commits)")

---

Tags

emaillaraveltemplateframeworklaravelcssemailtemplateoptimization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lanin-laravel-email-templates-optimization/health.svg)

```
[![Health](https://phpackages.com/badges/lanin-laravel-email-templates-optimization/health.svg)](https://phpackages.com/packages/lanin-laravel-email-templates-optimization)
```

###  Alternatives

[graham-campbell/markdown

Markdown Is A CommonMark Wrapper For Laravel

1.3k7.1M64](/packages/graham-campbell-markdown)[lanin/laravel-api-exceptions

All in one solution for exception for JSON REST APIs on Laravel and Lumen.

40102.4k](/packages/lanin-laravel-api-exceptions)[krzysiekpiasecki/gentelella

A Symfony skeleton application with user account functionality based on the Twitter Bootstrap and Gentelella template

991.8k](/packages/krzysiekpiasecki-gentelella)

PHPackages © 2026

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