Download the PHP package mscode-pl/laravel-react-email without Composer
On this page you can find all versions of the php package mscode-pl/laravel-react-email. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mscode-pl/laravel-react-email
More information about mscode-pl/laravel-react-email
Files in mscode-pl/laravel-react-email
Package laravel-react-email
Short Description Build Laravel mailables with react-email
License MIT
Homepage https://github.com/mscode-pl/laravel-react-email
Informations about the package laravel-react-email
Laravel React Email
Build Laravel email templates using react-email components. Variables from your Mailable are injected at send-time via Laravel Blade — no static strings hardcoded into HTML.
How it works
The build step compiles your TSX to static HTML and replaces placeholder props with Blade expressions:
| In template | In compiled Blade |
|---|---|
$$name$$ |
{{ $name }} |
$$user.email$$ |
{{ $user['email'] }} |
blade.number('price') + {price.toFixed(2)} |
{{ $price }} |
<BladeForEach items="items"> |
@foreach($items as $item) |
<BladeIf condition="fee > 0"> |
@if($fee > 0) |
Installation
1. Composer
2. Publish config
3. npm dependencies
Install react-email and link the library from your vendor directory so TSX templates can import its helpers:
Then add to your project's package.json:
Run npm install once more to create the symlink:
Why? The package lives in
vendor/(Composer only, not published to npm). Thefile:reference letstsxresolveimport { blade } from '@mscode-pl/laravel-react-email'correctly.
Quick start
Generate a Mailable + template
Creates:
app/Mail/WelcomeEmail.phpresources/react-email/welcome-email.tsx
Write the template
resources/react-email/welcome-email.tsx:
Build
Send
app/Mail/WelcomeEmail.php:
Variables
Simple string variables
Use $$variableName$$ directly in JSX text. The build step converts them to {{ $variableName }}.
Compiled Blade output:
Nested object variables
Dot notation is converted to array access:
Compiled Blade output:
Numeric variables
Use blade.number('varName') so methods like .toFixed() work at build time without crashing:
Compiled Blade output:
Blade handles the actual number formatting at send-time with
number_format($total, 2)etc.
Lists / arrays — <BladeForEach>
Use the <BladeForEach> component to loop over an array. Inside, write $$item.property$$ placeholders:
Compiled Blade output:
For nested arrays (e.g. order.items):
Compiles to:
Conditional sections — <BladeIf>
Use <BladeIf> to wrap content that should only appear when a condition is true:
Compiled Blade output:
blade() helper reference
| Helper | TypeScript type | Use when |
|---|---|---|
blade('name') |
any |
generic placeholder |
blade.string('name') |
string |
plain text, no method calls |
blade.number('name') |
number |
.toFixed(), arithmetic |
blade.array<T>('name') |
T[] |
.map(), .filter(), .reduce() |
blade.object<T>('name') |
T |
nested property access |
Commands
| Command | Description |
|---|---|
php artisan make:react-email <Name> |
Generate Mailable + TSX template |
php artisan react-email:build |
Compile all templates to Blade views |
php artisan react-email:dev |
Start live-preview server at localhost:3000 |
Configuration
config/react-email.php:
Requirements
- PHP 8.1 – 8.5
- Laravel 10, 11 or 12
- Node.js 16+
License
MIT — see LICENSE.
All versions of laravel-react-email with dependencies
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0|^11.0|^12.0