coloursfactory/refreshmailer

FreshMail.pl REST API 实现

dev-master 2017-06-21 09:03 UTC

This package is not auto-updated.

Last update: 2024-09-29 02:49:44 UTC


README

使用此包可以更方便地使用 freshmailer.pl REST API。

它使用适配器来提供正确的 PSR-7 兼容的 HTTP 服务。

实际上实现的适配器有

  • cURL
  • Guzzle6

欢迎提交新的适配器 :)

请参阅https://freshmail.pl/api_section/jak-zaczac/以获取大量文档。

http://freshmail.pl

安装

只需将其添加到您的 composer.json 文件中

{
    "require": {
        "preclowski/refreshmailer": "dev-master"
    }
}

或者,直接使用

composer require preclowski/refreshmailer

用法

use ColoursFactory\ReFreshMailer\FreshMailClient;
use ColoursFactory\ReFreshMailer\Http\GuzzleHttpAdapter;
use GuzzleHttp\Client;

$options = [
    'apiKey' => 'abcdef1234567890',
    'apiSecret' => 'abcdef1234567890',
];

$httpAdapter = new GuzzleHttpAdapter(new Client());
// or
$httpAdapter = new CurlHttpAdapter();

/** @var HttpAdapterInterface $httpAdapter */
$client = new FreshMailClient($httpAdapter, 'https://api.freshmail.com/rest/', $options);

$campaigns = $client->doRequest('/campaigns');

报告问题或功能请求

问题和功能请求在 Github 问题跟踪器中跟踪。