spectate/laravel-react-email 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

spectate/laravel-react-email

最新稳定版本:0.1.4

Composer 安装命令:

composer require spectate/laravel-react-email

包简介

Build Laravel mailables with react-email.

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Build Laravel mailables with react.email.

Installation

You can install the package via composer:

composer require spectate/laravel-react-email

Next up, install the required NPM packages:

npm i -D typescript react react-email @react-email/components @react-email/render @types/react @types/node

You can publish the config file with:

php artisan vendor:publish --tag="react-email-config"

Optional: Build templates on composer install

If you run composer install during deployments, this way you will automatically regenerate the React Email templates on each deploy.

To enable this, add the following to your composer.json file:

{
    "post-install-cmd": [
        "@php artisan react-email:build"
    ]
}

Usage

Create your first React Email template:

php artisan make:react-email MyFirstEmail

Optional: run the React Email dev server

You can run the React Email dev server to preview your templates:

php artisan react-email:dev

This will start the dev server and watch for changes in your templates.

Next up, edit the files in resources/views/react-emails and see the changes in your browser.

Using variables

To support variables in the compiled Blade templates, you can use the following syntax in your React Email templates:

export default function MyEmail() {
    return (
        <Html>
            Hello, $$name$$!
        </Html>
    );
}

This will be compiled to the following Blade template:

Hello, {{ $name }}!

Hot reloading

By default, on local development environments, the React Email templates are rendered on-the-fly for every send. This can be disabled by setting the REACT_EMAIL_HOT_RELOAD environment variable to false.

Building templates

You can build the React Email templates to HTML using the react-email:build command:

php artisan react-email:build

This will build all the templates and output them to resources/views/vendor/react-email.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 233
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-09