承接 netglue/laminas-postmark-transport 相关项目开发

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

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

netglue/laminas-postmark-transport

最新稳定版本:1.4.0

Composer 安装命令:

composer require netglue/laminas-postmark-transport

包简介

Mail transport using Postmark's API for applications using laminas components for email

README 文档

README

PHPUnit Test Suite Type Coverage

Caution

This library is now abandoned because laminas-mail is abandoned

Introduction

This lib provides a mail transport for use with Laminas\Mail and Postmark’s transactional email service. It also provides email message validators to help make sure that messages you send via Postmark are acceptable - I'm quite pleased with the validator that checks the from address is listed in the verified postmark domains on your account, or amongst the configured sender signatures.

Installation

composer require netglue/laminas-postmark-transport

If you are using this in an app built with Expressive/Mezzio then the config provider should get injected automatically for you during installation by way of the Laminas component installer. If you're using Laminas MVC then you might have to take extra steps to get the default config fired up.

One of the dependencies is a tiny package netglue/psr-container-postmark - this is what's used to configure the official Postmark API client so you can find some additional info in the README in that lib for configuring your account and server tokens for the service.

Usage

By default, assuming use of Laminas Service Manager for your DIC, you will be able to retrieve your transport using either:

$transport = $container->get(\Laminas\Mail\Transport\TransportInterface::class);
// or
$transport = $container->get(\Netglue\Mail\Postmark\Transport\PostmarkTransport::class);

As with all mail transports, you'll only interact with it to send a Laminas\Mail\Message:

$message = new Message();
// ... Set To, From, Subject etc...
$transport->send($message);

Read up on the docs specific to sending mail with Laminas components here...

The main reason that I put this lib together is so that I could validate messages before dispatching them to the API to surface common errors such as an invalid sender address, too many recipients etc. The transport accepts a validator in its constructor arguments that is used to enforce the constraints placed on sending mail with Postmark specifically.

There is a default validator chain that you can inspect covering most of these constraints and a shipped FromAddressValidator that is not used by default. The reason this one isn't initially enabled is because it makes API calls to the account endpoints to retrieve the configured sending domains and email addresses and then checks that the From header of the message is amongst the verified senders.

So, to use this validator, you'd need to:

  • Configure the access token for the account API
  • Inject a different validator chain into the transport
  • Provide the name of a PSR-6 compatible cache that can be retrieved from the container

Hopefully the following configuration should illuminate what's required...

'postmark' => [
    'server_token' => 'Your "server" token for sending mail',
    'account_token' => 'Token for the account API', // Required when using the sender validator
    'message_validator' => \MyApp\Validator\CustomMessageValidationChain::class,
    'cache_service' => \MyApp\PsrCacheItemPool::class, // The cache to use for the domain and sender signatures list.
],

Finally, this lib also has a dependency on netglue/laminas-mail-utils which is primarily a collection of more generic validators for mail messages and message behaviours that are intended for use with other vendors such as SparkPost, MailGun etc. If/when you build your custom validator chain, there are a bunch of validators there that might be useful.

netglue/laminas-postmark-transport 适用场景与选型建议

netglue/laminas-postmark-transport 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.49k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-20