PHPackages                             stayallive/laravel-mail-css-inliner - 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. stayallive/laravel-mail-css-inliner

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

stayallive/laravel-mail-css-inliner
===================================

Inline the CSS of your Laravel HTML emails.

v4.6.0(2mo ago)5101.4k↑266.9%1MITPHPPHP ^8.1CI passing

Since Feb 6Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/stayallive/laravel-mail-css-inliner)[ Packagist](https://packagist.org/packages/stayallive/laravel-mail-css-inliner)[ Docs](https://github.com/stayallive/laravel-mail-css-inliner)[ GitHub Sponsors](https://github.com/stayallive)[ RSS](/packages/stayallive-laravel-mail-css-inliner/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (9)Dependencies (10)Versions (21)Used By (0)

Laravel Mail CSS Inliner
========================

[](#laravel-mail-css-inliner)

[![Latest Version](https://camo.githubusercontent.com/c3c7e2636cf4abcff9997d88d7acfc3ba969778ff8661299d70f89adddfbab00/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73746179616c6c6976652f6c61726176656c2d6d61696c2d6373732d696e6c696e65722e7376673f7374796c653d666c61742d737175617265)](https://github.com/stayallive/laravel-mail-css-inliner/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/83c755805bc771e32996532d71450feb7915b6277af0cd31de4d35407259bf8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73746179616c6c6976652f6c61726176656c2d6d61696c2d6373732d696e6c696e65722f63692e79616d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/stayallive/laravel-mail-css-inliner/actions/workflows/ci.yaml)[![Total Downloads](https://camo.githubusercontent.com/298121da97e2252a1c11c423d6d3c529b149bfb77127414278b0210ed0dae97d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746179616c6c6976652f6c61726176656c2d6d61696c2d6373732d696e6c696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stayallive/laravel-mail-css-inliner)

Why?
----

[](#why)

Most email clients won't render CSS (on a `` or a ``). The solution is inline your CSS directly on the HTML. Doing this by hand easily turns into unmaintainable templates. The goal of this package is to automate the process of inlining that CSS before sending the emails.

How?
----

[](#how)

Using a wonderful [CSS inliner package](https://github.com/tijsverkoyen/CssToInlineStyles) wrapped in a SwiftMailer plugin and served as a Service Provider it just works without any configuration. Since this is a SwiftMailer plugin, it will automatically inline your css when parsing an email template. You don't have to do anything!

Turns style tag:

```

            h1 {
                font-size: 24px;
                color: #000;
            }

        Hey you

```

Or the link tag:

```

        Hey you

```

Into this:

```

            h1 {
                font-size: 24px;
                color: #000;
            }

        Hey you

```

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

[](#installation)

This package requires at least Laravel `9` and PHP `8`.

Begin by installing this package through composer. Require it directly from the CLI to take the last stable version:

```
composer require stayallive/laravel-mail-css-inliner
```

At this point the inliner should be already working with the default options. If you want to fine-tune these options, you can do so by publishing the configuration file:

```
$ php artisan vendor:publish --provider='Stayallive\LaravelMailCssInliner\ServiceProvider'
```

and changing the settings on the generated `config/mail-css-inliner.php` file.

### Testing

[](#testing)

```
composer test
```

Found a bug?
------------

[](#found-a-bug)

Please, let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

This is a fork from [fedeisas/laravel-mail-css-inliner](https://github.com/fedeisas/laravel-mail-css-inliner).

The forked package is greatly inspired, and mostly copied, from [SwiftMailer CSS Inliner](https://github.com/OpenBuildings/swiftmailer-css-inliner).

- [Alex Bouma](https://github.com/stayallive)
- [All Contributors](../../contributors)
- [All Contributors from fedeisas/laravel-mail-css-inliner](https://github.com/fedeisas/laravel-mail-css-inliner/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

59

—

FairBetter than 98% of packages

Maintenance83

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

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

Recently: every ~286 days

Total

20

Last Release

84d ago

Major Versions

1.5 → 2.02016-09-20

2.3 → v3.0.02020-03-29

v3.1.0 → v4.0.02022-02-09

PHP version history (5 changes)1.0PHP &gt;=5.3.2

1.5PHP &gt;=5.4.0

v3.0.0PHP &gt;=7.3.0

v4.0.0PHP ^8.0.2

v4.6.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1090754?v=4)[Alex Bouma](/maintainers/stayallive)[@stayallive](https://github.com/stayallive)

---

Top Contributors

[![fedeisas](https://avatars.githubusercontent.com/u/251675?v=4)](https://github.com/fedeisas "fedeisas (34 commits)")[![stayallive](https://avatars.githubusercontent.com/u/1090754?v=4)](https://github.com/stayallive "stayallive (27 commits)")[![ceesvanegmond](https://avatars.githubusercontent.com/u/883497?v=4)](https://github.com/ceesvanegmond "ceesvanegmond (19 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (9 commits)")[![kilburn](https://avatars.githubusercontent.com/u/116100?v=4)](https://github.com/kilburn "kilburn (5 commits)")[![Belphemur](https://avatars.githubusercontent.com/u/197810?v=4)](https://github.com/Belphemur "Belphemur (2 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (2 commits)")[![mathieutu](https://avatars.githubusercontent.com/u/11351322?v=4)](https://github.com/mathieutu "mathieutu (2 commits)")[![Maxoulak](https://avatars.githubusercontent.com/u/30724805?v=4)](https://github.com/Maxoulak "Maxoulak (2 commits)")[![underthecocotree](https://avatars.githubusercontent.com/u/18592003?v=4)](https://github.com/underthecocotree "underthecocotree (2 commits)")[![bitdeli-chef](https://avatars.githubusercontent.com/u/3092978?v=4)](https://github.com/bitdeli-chef "bitdeli-chef (1 commits)")[![winkbrace](https://avatars.githubusercontent.com/u/1883930?v=4)](https://github.com/winkbrace "winkbrace (1 commits)")[![nickbarrettjb](https://avatars.githubusercontent.com/u/16773808?v=4)](https://github.com/nickbarrettjb "nickbarrettjb (1 commits)")[![incraigulous](https://avatars.githubusercontent.com/u/5910297?v=4)](https://github.com/incraigulous "incraigulous (1 commits)")[![jezmck](https://avatars.githubusercontent.com/u/89996?v=4)](https://github.com/jezmck "jezmck (1 commits)")[![pabloroman](https://avatars.githubusercontent.com/u/450173?v=4)](https://github.com/pabloroman "pabloroman (1 commits)")[![gms8994](https://avatars.githubusercontent.com/u/50712?v=4)](https://github.com/gms8994 "gms8994 (1 commits)")

---

Tags

csslaravellaravel-packagemailerlaravelcsslaravel-packagemailer

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/stayallive-laravel-mail-css-inliner/health.svg)

```
[![Health](https://phpackages.com/badges/stayallive-laravel-mail-css-inliner/health.svg)](https://phpackages.com/packages/stayallive-laravel-mail-css-inliner)
```

###  Alternatives

[fedeisas/laravel-mail-css-inliner

Inline the CSS of your HTML emails using Laravel

6084.8M3](/packages/fedeisas-laravel-mail-css-inliner)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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