Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Zurb Ink Bundle Laravel Package

gremo/zurb-ink-bundle

GremoZurbInkBundle integrates the ZURB Ink responsive email framework into Symfony, giving developers bundle configuration and helpers to build mobile-friendly HTML email templates for transactional messages within their applications.

View on GitHub
Deep Wiki
Context7

Getting Started

Read this first: it's a Symfony bundle, not a Laravel package. There is no service provider, no config/zurb-ink.php to publish, and no facade. composer require gremo/zurb-ink-bundle in a Laravel app will pull in Symfony-era dependencies (the last tagged release is from August 2018) and give you nothing wired up. The realistic way a Laravel developer "uses" this package is as a reference implementation: it shows how to take an Ink-flavoured Twig/Blade template and turn it into email-safe HTML by running Ink's component parsing plus CSS inlining as a render step.

If you are actually on Symfony, the flow is: register the bundle in AppKernel/bundles.php, let it wire its Twig extension, then apply the provided filter to a template rendered from Ink markup — the bundle's job is essentially "render → parse Ink components → inline the stylesheet → hand back a string you can put in a Swift_Message/Email."

For a Laravel app, the minimal equivalent path is:

  1. Add Zurb Ink as an asset dependency (npm or the CDN <link>/<script> pair) — you want ink.css plus the Ink components in your email layout.
  2. Build a resources/views/emails/layouts/ink.blade.php with the standard Ink boilerplate (<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ...>, the <style> block with ink.css inlined via @include or a raw file read, and the ink.min.js script tag guarded by the Outlook conditional comment).
  3. Inline the CSS at send time — Laravel already does this for you in Markdown mailables via tijsverkoyen/css-to-inline-styles, and you can call CssToInlineStyles directly for plain Blade mailables. That is the same conceptual slot the bundle fills.
  4. Send through a Mailable + Mail::to(...)->send(...), not through the bundle's message helpers.

First use case: a welcome email with a two-column Ink grid and a button. Render it, inline the CSS, open the raw HTML in a browser, then run it through Litmus or Email on Acid before shipping. The bundle's value to you is the inlining step; the Ink framework itself is just HTML/CSS you vendor in.

Implementation Patterns

Render-then-inline, not inline-in-template. Keep the styling in a <style> block in the layout and treat inlining as a post-processing pass. The bundle's Twig extension is built around this, and it's the only pattern that survives contact with Gmail (which strips <style> in some contexts but honours inlined attributes) alongside Outlook (which needs the conditional-comment fallbacks Ink emits).

Wrap the inliner in a small service or trait. In Laravel terms:

class InkedMailable extends Mailable
{
    public function build()
    {
        $html = view('emails.welcome', $this->viewData)->render();
        $html = (new CssToInlineStyles())->convert($html, $this->inkCss());

        return $this->html($html)->subject('Welcome');
    }
}

Cache $this->inkCss() (the contents of ink.css) — reading and re-parsing it on every send is wasted work in a queue worker that fires thousands of emails.

Mirror the bundle's extension point rather than its code. The bundle exposes its inliner as a Twig filter; the Laravel equivalent is a Blade directive or a View::composer that post-processes rendered email views. Pick one and standardise on it, because double-inlining (once in a composer, once in the Mailable) produces bloated, hard-to-debug output.

Keep Ink's JS out of the send path. ink.min.js is a preview-time / client-side polyfill for Outlook's ghost-table behaviour. You do not run it server-side. Ship the <script> tag in the layout wrapped in <!--[if mso]> ... <![endif]-->-adjacent conditionals and let the mail client deal with it. Any Node/PhantomJS step to "run Ink server-side" is a maintenance trap.

Preview route in local/staging. Add a Route::get('/emails/{view}') behind app()->isLocal() that renders the Mailable and dumps $mailable->render() straight to the browser. This is the single highest-value piece of tooling; the bundle gives you nothing here, and you'll iterate on templates far more than on send logic.

Test with Mail::fake() and assert on rendered HTML. Mail::assertSent(WelcomeMail::class, fn ($mail) => str_contains($mail->render(), 'background-color')) catches the classic "CSS didn't inline" regression, which is invisible in a normal feature test.

Gotchas and Tips

  • Archived since 2018 and pinned to Symfony 2/3-era APIs. On PHP 8.x with Laravel 10/11 you will hit dependency resolution failures or, worse, install successfully and get runtime deprecations from the underlying inliner. Treat the repo as documentation, not a dependency.
  • It solves a problem Laravel already solved. Markdown mailables inline CSS automatically. Before adding any of this, check whether CssToInlineStyles (already a transitive dependency of laravel/framework) covers your need — it usually does.
  • Media queries cannot be inlined. @media (max-width: 600px) blocks must stay in the <style> head. If your pipeline strips or fully inlines the stylesheet, mobile layouts silently break. The bundle's inliner, like every other, will drop or mangle these unless you keep the original <style> block in the output.
  • Inlining after the fact beats inlining in the template, but order matters. Ink's grid CSS must be inlined after Ink component expansion, otherwise the generated <table> wrappers get no styles. If you write Ink components by hand (no JS expansion step), this is fine; if you rely on the JS to expand them, you have an ordering bug the bundle also has.
  • Outlook still needs conditional comments and mso- properties. Nothing in this bundle or in CSS inlining fixes Outlook's 120 DPI scaling or its lack of max-width. Budget for testing in actual Outlook, not just the HTML preview.
  • Watch for !important stripping. Several inliners (including older CssToInlineStyles versions) handle !important inconsistently; Ink's own CSS leans on specificity, so validate the output rather than assuming it round-trips.
  • Debugging tip: log the final HTML string once per template (Storage::put('debug/'.$mailable.'.html', $html)) and diff it against the pre-inline render. Nine out of ten "email looks broken" bugs are either a missing stylesheet include or a double-inline pass.
  • Extension point worth stealing: the bundle's separation of "template rendering" from "transformation" is the right seam. Implement it as a single middleware-ish service (EmailRenderer), inject it into mailables, and you can swap the inliner implementation later — or drop it entirely if you move to Markdown mailables — without touching a single template.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib