ahmedrady255/email-template-manager
Composer 安装命令:
composer require ahmedrady255/email-template-manager
包简介
this package is made to provide templates for different types
README 文档
README
A Laravel package for managing email templates with built-in SMTP configuration.
Features
- Manage and customize email templates.
- Send emails with different types using predefined templates.
- Simple SMTP configuration and integration.
- Easy-to-use API for sending emails.
Installation
1. Install the Package
You can install the package via Composer:
composer require ahmedrady255/email-template-manager
3. Install SMTP Configuration (Optional)
Run the SMTP installation command to set up default SMTP settings:
php artisan email-template-manager:install-smtp
Configuration
SMTP Settings
The package uses SMTP for sending emails. You can configure the SMTP settings in your .env file or in the config/email_templates.php configuration file.
Example .env settings:
MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=your-smtp-username MAIL_PASSWORD=your-smtp-password MAIL_ENCRYPTION=tls MAIL_FROM_ADDRESS=your-email@example.com MAIL_FROM_NAME="${APP_NAME}"
Email Templates
Define and customize email templates in the resources/views/vendor/email-templates/ directory. By default, this directory contains the template files you can modify.
Example template:
resources/views/vendor/email-templates/welcome_email.blade.php
<!DOCTYPE html> <html> <head> <title>Welcome to Our Service</title> </head> <body> <h1>Hello {{ $name }},</h1> <p>Thank you for signing up for our service!</p> <p>Best regards,</p> <p>The Team</p> </body> </html>
Usage
Sending an Email
You can send email by add the service to your controller
Example Request:
<?php namespace EmailTemplateManager\Http\Controllers; use Illuminate\Http\Request; use EmailTemplateManager\Services\EmailService; class EmailController extends Controller { protected $emailService; public function __construct(EmailService $emailService) { $this->emailService = $emailService; } public function sendEmail(Request $request) { $emailType = $request->input('email_type'); // Email type (welcome, order, etc.) $recipient = $request->input('email'); $data = $request->all(); $this->emailService->sendEmail($emailType, $data, $recipient); return response()->json(['message' => 'Email sent successfully.']); } }
Testing
To ensure everything works correctly, you can run the package tests:
php artisan test
Contributing
- Fork the repository.
- Create a new branch for your feature or fix.
- Commit your changes.
- Push to the branch and create a pull request.
License
This package is licensed under the MIT License. See the LICENSE file for details.
Support
For issues or questions, please create an issue on GitHub Issues.
ahmedrady255/email-template-manager 适用场景与选型建议
ahmedrady255/email-template-manager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 09 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ahmedrady255/email-template-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ahmedrady255/email-template-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-15