承接 znarkus/postmark 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

znarkus/postmark

Composer 安装命令:

composer require znarkus/postmark

包简介

Postmark PHP class

README 文档

README

Copyright 2009 - 2011, Markus Hedlund, Mimmin AB, www.mimmin.com Licensed under the MIT License. Redistributions of files must retain the above copyright notice.

Additional contributors

  • Jeff Downie
  • August Trometer
  • Hristo Deshev
  • jeffreyhunter77
  • John Beales
  • Geoff Wagstaff
  • beaudesigns
  • Gabriel Bull

Requirements

All in-data must be encoded with UTF-8.

Getting started

// Create a "server" in your "rack", then copy it's API key
$postmarkApiKey = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
    
// Create a message and send it
Postmark\Mail::compose($postmarkApiKey)
    ->from('john@smith.com', 'John Smith')
    ->addTo('jane@smith.com', 'Jane Smith')
    ->subject('Subject')
    ->messagePlain('Plaintext message')
    ->send();

Configuration

There are two ways of configuration.

Adapter

An adapter class should be used for a more dynamic configuration. The adapter must implement Postmark\MailAdapterInterface. These are the methods that must be implemented.

  • getApiKey - Should return the API key
  • setupDefaults(Postmark\Mail &$mail) - May be used to setup a default email, e.g. set From address.
  • log($logData) - Is called immediately after the email is sent. $logdata is an array with keys messageData, return, curlError and httpCode.

See Tests/Adapter.php for example usage.

Usage

Postmark\Mail::compose($postmarkApiKey)
	->from('address@example.com', 'Name')
	->addTo('address@example.com', 'Name')
	->subject('Subject')
	->messagePlain('Plaintext message')
	->send();

or:

$email = new Postmark\Mail($postmarkApiKey);
$email->from('address@example.com', 'Name')
	->addTo('address@example.com', 'Name')
	->subject('Subject')
	->messagePlain('Plaintext message')
	->send();

Error handling

See PHPDOC for details on Exceptions thrown. If no API key is set, an E_USER_ERROR will be raised.

Debugging

Call method debug(Postmark\Mail::DEBUG_VERBOSE) or debug(Postmark\Mail::DEBUG_RETURN) to enable debug mode. DEBUG_VERBOSE prints debug info and DEBUG_RETURN makes send() return debug info as an array.

Unit tests

Unit tests are located in Tests/. Simple test is the unit test framework being used.

Adapter.php runs all tests relevant for adapter configuration.

E-mail address validation

This class uses a regular expression to validate e-mail addresses, in addition to the validation Postmark does. This regex isn't perfect. If you need more extensive validation, please try http://www.dominicsayers.com/isemail/.

znarkus/postmark 适用场景与选型建议

znarkus/postmark 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 91.4k 次下载、GitHub Stars 达 137, 最近一次更新时间为 2013 年 04 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「email」 「postmark」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 91.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 137
  • 点击次数: 30
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 137
  • Watchers: 4
  • Forks: 47
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-04-05