定制 netglue/psr-container-postmark 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

netglue/psr-container-postmark

最新稳定版本:1.12.0

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.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固