stephanecoinon/mailtrap 问题修复 & 功能扩展

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

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

stephanecoinon/mailtrap

Composer 安装命令:

composer require stephanecoinon/mailtrap

包简介

PHP client for Mailtrap.

README 文档

README

Installation

First install this package using composer:

composer require stephanecoinon/mailtrap

Plain Vanilla PHP

use StephaneCoinon\Mailtrap\Client;
use StephaneCoinon\Mailtrap\Model;

// Instantiate Mailtrap API client
$client = new Client('your_mailtrap_api_token_here');

// Boot API models
Model::boot($client);

Laravel

This package includes a Laravel service provider (tested for Laravel v5.4).

Add your Mailtrap API token to your .env file.

MAILTRAP_API_TOKEN=your_mailtrap_api_token_here

Then add mailtrap in your config/services.php configuration:

'mailtrap' => [
    'token' => env('MAILTRAP_API_TOKEN'),
],

Finally, if your app runs on Laravel < 5.5, register the Mailtrap service provider in config/app.php:

'providers' => [
    // ...

    /*
     * Package Service Providers...
     */
    // ...

    StephaneCoinon\Mailtrap\MailtrapServiceProvider::class,

    // ...
],

Otherwise it will be discovered automatically on Laravel >= 5.5.

Usage

use StephaneCoinon\Mailtrap\Inbox;

// Fetch all inboxes
$inboxes = Inbox::all();

// Fetch an inbox by its id
$inbox = Inbox::find(1234);

// Get all messages in an inbox
$messages = $inbox->messages();

// Get a message by its id
$message = $inbox->message(123456789);
$message->htmlBody(); // Get the HTML body (also sets html_body attribute on the message)
$message->textBody(); // Get the plain text body (also sets txt_body attribute on the message)
$message->rawBody(); // Get the raw body (also sets raw_body attribute on the message)
$message->headers(); // Get the headers as an array (also sets headers attribute on the message)

// Get the last (newest) message in an inbox
$newestMessage = $inbox->lastMessage();

// Delete all messages from an inbox
$inbox = $inbox->empty();
$inbox = (new Inbox)->empty(1234); // alternative syntax using the inbox id

// Determine whether the inbox contains a message for a given recipient e-mail
$recipientReceivedMessage = $inbox->hasMessageFor('john@example.com');

// Get message recipients as an array
$recipients = $message->recipientEmails();

stephanecoinon/mailtrap 适用场景与选型建议

stephanecoinon/mailtrap 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37.27k 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 03 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 stephanecoinon/mailtrap 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 stephanecoinon/mailtrap 我们能提供哪些服务?
定制开发 / 二次开发

基于 stephanecoinon/mailtrap 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 37.27k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 8
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-03-09