netglue/psr-container-postmark 问题修复 & 功能扩展

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

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

netglue/psr-container-postmark

Composer 安装命令:

composer require netglue/psr-container-postmark

包简介

Postmark client factories for PSR Containers

README 文档

README

PHPUnit Test Suite Type Coverage

Introduction

This very small library provides PSR-11 compatible factories for creating Postmark HTTP clients for either servers for sending mail, or the admin client for managing your account.

Postmark is a reliable transactional email delivery service. These factories return clients from their official PHP library.

Install

composer require netglue/psr-container-postmark

Usage

By default, the container will look for application configuration using the id config which is a generally accepted standard. If your PSR-11 container doesn't return an associative array when calling $container->get('config') then this lib will likely be useless to you.

Postmark-specific configuration is, by default, expected underneath the 'postmark' key, though this can be modified.

Assuming defaults, your configuration for the clients should look like this:

return [
    'postmark' => [
        'server_token' => 'Your Server Token',
        'server_timeout' => 30, // The default is 30, as per Postmark's libs so this option can be omitted
        'admin_token' => 'Your Account Token', // Only required if you are using the Admin client to manage an account
    ],
];

You would then wire up your container so that a key of your choosing is mapped to the factory classes, perhaps:

return [
    'dependencies' => [
        'factories' => [
            Postmark\PostmarkClient::class => Netglue\PsrContainer\Postmark\ClientFactory::class,
            Postmark\PostmarkAdminClient::class => Netglue\PsrContainer\Postmark\AdminClientFactory::class,
        ],
    ],   
];

If you run multiple servers for some reason, you can wire up the factory in the following way to use different configuration for different servers:

return [
    'dependencies' => [
        'factories' => [
            'EmailServer1' => [Netglue\PsrContainer\Postmark\ClientFactory::class, 'postmark_server_1'],
            'EmailServer2' => [Netglue\PsrContainer\Postmark\ClientFactory::class, 'postmark_server_2'],
        ],
    ],   
];

Given the above container setup, you'd need to specify two top-level configuration arrays with a server key in each for 'postmark_server_1' and 'postmark_server_2'

Laminas Integration

Because I use Laminas (Formerly Zend) components a lot, this lib will auto-wire dependencies (if you choose to allow it) during composer installation thanks to laminas-component-installer.

fin.

netglue/psr-container-postmark 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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