renzojohnson/mailgun-api
Composer 安装命令:
composer require renzojohnson/mailgun-api
包简介
Lightweight PHP wrapper for Mailgun API. Send emails, validate addresses, manage domains. Zero dependencies beyond ext-curl.
README 文档
README
Lightweight PHP wrapper for Mailgun API. Send emails, validate addresses, manage domains. Zero dependencies beyond ext-curl.
Author: Renzo Johnson
Requirements
- PHP 8.4 or higher
ext-curlext-json
Installation
composer require renzojohnson/mailgun-api
Quick Start
use RenzoJohnson\Mailgun\Mailgun; $mailgun = new Mailgun('key-your-api-key', 'mg.yourdomain.com'); // Send a simple text email $mailgun->sendText( 'sender@mg.yourdomain.com', 'recipient@example.com', 'Hello from Mailgun', 'This is the email body.' );
Send HTML Email
$mailgun->sendHtml( 'sender@mg.yourdomain.com', 'recipient@example.com', 'Welcome!', '<h1>Welcome</h1><p>Thanks for signing up.</p>', 'Welcome! Thanks for signing up.' // optional plain text fallback );
Advanced Email Builder
use RenzoJohnson\Mailgun\Message\Email; $email = new Email( 'sender@mg.yourdomain.com', 'recipient@example.com', 'Order Confirmation', text: 'Your order has been confirmed.', html: '<h1>Order Confirmed</h1>' ); $email->cc('manager@example.com') ->bcc('archive@example.com') ->replyTo('support@example.com') ->header('X-Campaign', 'welcome-series') ->variable('order_id', '12345') ->tag('transactional'); $mailgun->send($email);
Domain Info
// Get domain details $info = $mailgun->getDomainInfo(); // List all domains $domains = $mailgun->listDomains();
Events & Stats
// Get sending events $events = $mailgun->getEvents(['event' => 'delivered', 'limit' => 10]); // Get delivery stats (last 7 days) $stats = $mailgun->getStats('delivered', 7);
Email Validation
// Validate an email address (requires validation API key) $result = $mailgun->validateEmail('user@example.com');
Error Handling
use RenzoJohnson\Mailgun\Exception\ApiException; try { $mailgun->sendText('from@mg.example.com', 'to@example.com', 'Test', 'Body'); } catch (ApiException $e) { echo $e->getMessage(); // "Mailgun API error (401): Forbidden" }
Links
License
MIT License. Copyright (c) 2026 Renzo Johnson.
renzojohnson/mailgun-api 适用场景与选型建议
renzojohnson/mailgun-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「email」 「mailgun」 「transactional-email」 「email-api」 「mailgun-api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 renzojohnson/mailgun-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 renzojohnson/mailgun-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 renzojohnson/mailgun-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Send emails from multiple domains with mailgun
Mailgun integration for SilverStripe emails
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
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-17