- Can I use notfloran/mjml-bundle in Laravel instead of Symfony?
- Yes, but it is a Symfony bundle, not a Laravel package. Laravel does not register Symfony bundles, so you autoload the renderer classes directly and bind them in a service provider, bypassing the bundle's DI and config layers. Treat it as a thin library, not a framework integration.
- How do I install notfloran/mjml-bundle with Composer in a Laravel app?
- Run composer require notfloran/mjml-bundle, then bind the package's renderer to your own interface in a service provider with the mjml binary path read from config. Audit composer why-not first, because the Symfony component constraints can collide with Symfony packages Laravel already requires. Do not attempt to register the Symfony bundle itself.
- Does notfloran/mjml-bundle require Node.js and the mjml CLI in production?
- Only if you render at runtime. In that case Node 18 or 20 LTS plus a pinned global mjml binary must exist in every PHP container, and each render shells out to that binary and parses its output. For static transactional templates, compile MJML in CI instead and remove Node from production entirely.
- What Laravel and PHP versions does notfloran/mjml-bundle support?
- The README does not publish a Laravel or PHP version matrix, since the package targets Symfony. In practice you need PHP 8.2+ for Laravel 10 or 11, plus a Node 18 or 20 LTS runtime for the mjml binary. Check the Symfony component constraints against your Laravel version with composer why-not before committing.
- How do I render MJML templates to Blade views at build time in Laravel?
- Add a CI job that compiles resources/mjml/*.mjml into resources/views/emails/*.blade.php and ship the compiled output in your release artifact. Your Mailables then reference plain Blade views, and production never needs Node or mjml. This also makes output deterministic and reviewable in diffs.
- Does notfloran/mjml-bundle work with MJML 4 or MJML 5?
- The v3.11.0 changelog mentions adapting the BinaryRenderer for MJML 5, and nothing documents automatic version detection or a fallback for MJML 4. Pin the mjml binary with a lockfile or fixed image tag that matches the package version you install. Because MJML 5 may not be broadly GA, treat it as a moving target and re-test rendered output after upgrades.
- How should I test MJML email rendering in a Laravel test suite?
- Fake or stub the renderer behind your own interface so unit tests never spawn a Node process. Keep a small integration test that runs against the real pinned mjml binary in CI to catch version skew between the package and the CLI. Assert on HTML structure and key content rather than exact markup, since MJML output can shift between versions.
- Is runtime MJML rendering safe for user-supplied template content?
- It carries real risk. If template content or parameters reach the binary without escaping via argument arrays, you get a command-injection surface, and MJML's mj-include and mj-raw features give template authors filesystem-read and arbitrary-HTML primitives. Restrict runtime rendering to trusted, version-controlled templates or compile at build time only.
- Are there alternatives to notfloran/mjml-bundle for MJML in Laravel?
- You can compile MJML with the mjml CLI in a CI step and commit the Blade output, call a hosted MJML HTTP rendering API at runtime, or use a pure-PHP mail framework with responsive layout primitives. For most Laravel apps, build-time compilation is simpler and removes the Node dependency. The package is mainly worth it as a small renderer wrapper when you need one.
- Is notfloran/mjml-bundle actively maintained, and how do I handle Symfony version conflicts?
- It is a small single-maintainer project, and v3.11.0 shipped with a one-line changelog and no migration notes, so bus-factor risk is real. Pin the exact package version and check for Symfony component constraint conflicts with composer why-not before upgrading. Keep a build-time compilation path so you can drop the dependency if needed.