omdiaries/laravel-ai-email-assistant
Composer 安装命令:
composer require omdiaries/laravel-ai-email-assistant
包简介
AI-powered email generator for Laravel (9, 10, 11 compatible) supporting OpenAI and Gemini
README 文档
README
AI-powered email generator for Laravel (9, 10, 11 compatible)
Generate professional, context-aware, and customizable emails using AI — directly from your Laravel app.
🧠 Key Features
✅ Multi-AI Provider Support — use OpenAI, Gemini, or add your own
✅ Customizable Tones — Formal, Friendly, Persuasive, Empathetic, etc.
✅ Dynamic Output Types — generate plain text, HTML, or Markdown emails
✅ Prebuilt Prompt Templates — Welcome, Invoice, Follow-up, Support
✅ Extendable Template System — easily define new templates
✅ Centralized Logging — detailed request/response tracking via Laravel logs
✅ Configurable Error Handling — automatic fallbacks when an AI provider fails
✅ Lightweight & Fast — optimized for production
🛠️ Installation
Step 1: Install the package via Composer
composer require omdiaries/laravel-ai-email-assistant
Step 2: Publish the configuration file
php artisan vendor:publish --tag=ai-email-assistant-config
Step 3: Add your environment variables
AI_PROVIDER=openai AI_API_KEY=your_api_key_here AI_TONE=formal AI_OUTPUT_TYPE=html
Step 4: Generate an AI-based email using Artisan
php artisan ai-email:generate welcome
💡 Example Usage (Controller)
use OmDiaries\AiEmailAssistant\Facades\AiEmail; $email = AiEmail::generate([ 'template' => 'invoice', 'tone' => 'friendly', 'outputType' => 'html', ]); Mail::to('john@example.com')->send(new InvoiceMail($email));
⚙️ Supported Templates
welcomeinvoicefollowupsupport
You can create your own custom templates under:
config/ai-email-assistant.php
🧩 Supported AI Providers
- OpenAI (GPT Models)
- Google Gemini
- (More coming soon)
You can easily extend it by creating a new Adapter class under:
app/Adapters/YourAIProviderAdapter.php
⚙️ Advanced Settings (From Code Base)
return [ // Default AI provider 'default_provider' => env('AI_PROVIDER', 'openai'), // Available providers 'providers' => [ 'openai' => [ 'api_key' => env('AI_API_KEY'), ], 'gemini' => [ 'api_key' => env('AI_API_KEY'), ], ], // Default tone for generated emails 'default_tone' => env('AI_TONE', 'formal'), // Output type: text, html, markdown 'default_output' => env('AI_OUTPUT_TYPE', 'html'), // Enable or disable logging of AI responses 'logging' => true, // Prompt templates 'templates' => [ 'welcome' => 'Write a warm welcome email for a new user...', 'invoice' => 'Create a polite invoice reminder email...', 'followup' => 'Generate a friendly follow-up email...', 'support' => 'Generate a professional support response...', ], ];
🧠 AIEmailService Overview
The main service handles:
- ✅ Provider selection (
OpenAI,Gemini, etc.) - ✅ Dynamic prompt generation from templates
- ✅ Error-safe API calls with fallback strategy
- ✅ Logging with
Log::info()andLog::error() - ✅ Flexible output type formatting
🔄 Upgrade Notes (from Beta)
- Added full multi-provider adapter support
- Introduced advanced tone and output customization
- Enhanced logging & debugging system
- Improved exception handling for provider timeouts
- Rewritten config system for flexibility
🧑💻 Contributing
Pull requests are welcome!
For new providers or features, please open an issue first to discuss the implementation.
🪪 License
This project is licensed under the MIT License.
© 2025 OmDiaries — All rights reserved.
omdiaries/laravel-ai-email-assistant 适用场景与选型建议
omdiaries/laravel-ai-email-assistant 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 29 次下载、GitHub Stars 达 3, 最近一次更新时间为 2025 年 10 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「email」 「laravel」 「ai」 「Gemini」 「openai」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 omdiaries/laravel-ai-email-assistant 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 omdiaries/laravel-ai-email-assistant 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 omdiaries/laravel-ai-email-assistant 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
Extensible library for building notifications and sending them via different delivery channels.
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
Laravel contact us form package to send email and save to database
Alfabank REST API integration
Phalcon Model Generator
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-31