PHPackages                             mperonnet/symfony-react-email - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mperonnet/symfony-react-email

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

mperonnet/symfony-react-email
=============================

React email for Symfony

1.0.3(1y ago)35.2k↓15.8%MITPHPPHP ^8.0

Since Mar 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mperonnet/symfony-react-email)[ Packagist](https://packagist.org/packages/mperonnet/symfony-react-email)[ Docs](https://github.com/mperonnet/symfony-react-email)[ RSS](/packages/mperonnet-symfony-react-email/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (8)Versions (5)Used By (0)

React Email for Symfony
=======================

[](#react-email-for-symfony)

Easily render [React Email](https://react.email/) templates with Symfony using this bundle.

> This package is a Symfony adaptation of [laravel-react-email](https://github.com/maantje/laravel-react-email) by Jamie Schouten.

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

[](#installation)

First, install the bundle via Composer:

```
composer require mperonnet/symfony-react-email
```

Then, install the required Node dependencies:

```
npm install vendor/mperonnet/symfony-react-email
```

Register the bundle in your `config/bundles.php`:

```
return [
    // ...
    Mperonnet\ReactEmail\ReactEmailBundle::class => ['all' => true],
];
```

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

[](#configuration)

Create a configuration file at `config/packages/react_email.yaml`:

```
react_email:
    template_directory: '%kernel.project_dir%/emails'
    # Optional: custom path to node executable
    # node_path: '/usr/local/bin/node'
    # Optional: custom path to tsx executable
    # tsx_path: '%kernel.project_dir%/node_modules/tsx/dist/cli.mjs'
```

Getting Started
---------------

[](#getting-started)

1. Install React Email using the [automatic](https://react.email/docs/getting-started/automatic-setup) or [manual](https://react.email/docs/getting-started/manual-setup) setup.
2. Create an email component in the configured `template_directory` (e.g., `emails/new-user.tsx`). Ensure the component is the default export.

Example email component:

```
import * as React from 'react';
import { Text, Html } from '@react-email/components';

export default function Email({ user }) {
    return (

            Hello, {user.name}

    );
}
```

3. Use the `ReactEmailRenderer` service to render your email templates:

```
use Mperonnet\ReactEmail\ReactEmailRenderer;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Mime\Email;

class UserController
{
    private ReactEmailRenderer $emailRenderer;
    private MailerInterface $mailer;

    public function __construct(
        ReactEmailRenderer $emailRenderer,
        MailerInterface $mailer
    ) {
        $this->emailRenderer = $emailRenderer;
        $this->mailer = $mailer;
    }

    public function createUser()
    {
        // Create a user...
        $user = [
            'name' => 'John Doe',
            'email' => 'john@example.com'
        ];

        // Render the email template
        $content = $this->emailRenderer->render('new-user', [
            'user' => $user
        ]);

        // Create a Symfony Email object
        $email = (new Email())
            ->html($content->html)
            ->text($content->text)
            ->subject('Welcome to our platform!')
            ->from('noreply@example.com')
            ->to($user['email']);

        // Send the email
        $this->mailer->send($email);

        // ...
    }
}
```

ReactEmailContent Structure
---------------------------

[](#reactemailcontent-structure)

The `ReactEmailRenderer::render()` method returns a `ReactEmailContent` object with the following properties:

```
class ReactEmailContent
{
    public readonly string $html; // The rendered HTML version of the email
    public readonly string $text; // The rendered plain text version of the email
}
```

Advanced Usage
--------------

[](#advanced-usage)

### Direct Integration with Symfony Mailer

[](#direct-integration-with-symfony-mailer)

The example below shows how to use the renderer with Symfony Mailer:

```
// Render the email template
$content = $this->emailRenderer->render('welcome-email', [
    'user' => $user,
    'resetLink' => $resetLink
]);

// Create and configure a Symfony Email object
$email = (new Email())
    ->html($content->html)
    ->text($content->text)
    ->subject('Welcome to our Application')
    ->from('noreply@example.com')
    ->to($user->getEmail());

// Send the email
$this->mailer->send($email);
```

### Use with Symfony Messenger

[](#use-with-symfony-messenger)

You can also use this with Symfony Messenger for asynchronous email sending:

```
// In your controller/service
$this->messageBus->dispatch(new SendEmailMessage(
    'welcome-email',
    ['user' => ['name' => $user->getName(), 'email' => $user->getEmail()]],
    'Welcome to our Platform!'
));

// In your message handler
class SendEmailMessageHandler
{
    public function __invoke(SendEmailMessage $message)
    {
        $content = $this->emailRenderer->render($message->template, $message->data);

        $email = (new Email())
            ->html($content->html)
            ->text($content->text)
            ->subject($message->subject)
            ->from('noreply@example.com')
            ->to($message->data['user']['email']);

        $this->mailer->send($email);
    }
}
```

Running Tests
-------------

[](#running-tests)

Run tests using PEST:

```
./vendor/bin/pest
```

Security
--------

[](#security)

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

License
-------

[](#license)

This bundle is open-source and licensed under the MIT License. See the [LICENSE](/LICENSE) file for details.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance42

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

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

Every ~0 days

Total

4

Last Release

479d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f7b2b371338f7ead3e54ce8ece2335ab16b84266911d9e3af155dc80083f5f0?d=identicon)[mperonnet](/maintainers/mperonnet)

---

Top Contributors

[![maantje](https://avatars.githubusercontent.com/u/9058265?v=4)](https://github.com/maantje "maantje (6 commits)")[![arvcork](https://avatars.githubusercontent.com/u/146995075?v=4)](https://github.com/arvcork "arvcork (1 commits)")[![mperonnet](https://avatars.githubusercontent.com/u/2752742?v=4)](https://github.com/mperonnet "mperonnet (1 commits)")[![rochmadnf](https://avatars.githubusercontent.com/u/53666901?v=4)](https://github.com/rochmadnf "rochmadnf (1 commits)")

---

Tags

symfonyreactreact email

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/mperonnet-symfony-react-email/health.svg)

```
[![Health](https://phpackages.com/badges/mperonnet-symfony-react-email/health.svg)](https://phpackages.com/packages/mperonnet-symfony-react-email)
```

PHPackages © 2026

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