mailerlite/mailerlite-api-v2-php-sdk 问题修复 & 功能扩展

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

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

mailerlite/mailerlite-api-v2-php-sdk

Composer 安装命令:

composer require mailerlite/mailerlite-api-v2-php-sdk

包简介

MailerLite API v2 PHP SDK

README 文档

README

This library is for MailerLite Classic. If you want to integrate with MailerLite please use https://github.com/mailerlite/mailerlite-php instead.

It is an official PHP SDK for the MailerLite Classic API.

You can find more examples and information about the MailerLite Classic API here: https://developers-classic.mailerlite.com/docs

Getting started

In order to use this library you need to have at least PHP 7.1 version.

There are two ways to use MailerLite PHP SDK:

Use Composer

If you are not familiar with Composer, learn about it here.

Then you will need to run this simple command using CLI:

composer require mailerlite/mailerlite-api-v2-php-sdk

This library is built atop of PSR-7 and PSR-18. If you are receiving Http\Discovery\Exception\DiscoveryFailedException exception, you will need to run:

composer require php-http/guzzle6-adapter
Manual (preferable for shared hostings)

This way is preferable only if you are using shared hosting and do not have a possibility to use Composer. You will need to download the source of the latest release from here, extract it and place its contents in the root folder of your project. The next step is the same as using Composer, you will need to require vendor/autoload.php file in your index.php and lets dive in!

Usage examples

Groups API

In the given example you will see how to initiate selected API and a few actions which are available:

  • Create group
  • Get groups
  • Update group
  • Get subscribers who belongs to selected group
$groupsApi = (new \MailerLiteApi\MailerLite('your-api-key'))->groups();

$newGroup = $groupsApi->create(['name' => 'New group']); // creates group and returns it

$allGroups = $groupsApi->get(); // returns array of groups

$groupId = 123;
$singleGroup = $groupsApi->find($groupId); // returns single item object

$subscribers = $groupsApi->getSubscribers($groupId); // get subscribers who belongs to selected group

$subscribers = $groupsApi->getSubscribers($groupId, 'unsubscribed'); // get unsubscribed subscribers who belongs to selected group

Use multiple APIs at once

Also `MailerLiteApi\MailerLite' object can be initiated before selecting API you want to use and it allows to achieve more.

$mailerliteClient = new \MailerLiteApi\MailerLite('your-api-key');

$groupsApi = $mailerliteClient->groups();
$groups = $groupsApi->get(); // returns array of groups

$fieldsApi = $mailerliteClient->fields();
$fields = $fieldsApi->get(); // returns array of fields

Use your preferred HTTP client

MailerLite SDK uses cURL as default HTTP client but it is easy to use your preferred client. It is achieved by using HTTPlug which is PSR-7 compliant HTTP client abstraction.

Here is an example how to use Guzzle instead of cURL:

$guzzle = new \GuzzleHttp\Client();
$guzzleClient = new \Http\Adapter\Guzzle6\Client($guzzle);

$mailerliteClient = new \MailerLiteApi\MailerLite('your-api-key', $guzzleClient);

Support and Feedback

In case you find any bugs, submit an issue directly here in GitHub.

You are welcome to create SDK for any other programming language.

If you have any troubles using our API or SDK free to contact our support by email info@mailerlite.com

Official documentation is at https://developers-classic.mailerlite.com/docs

mailerlite/mailerlite-api-v2-php-sdk 适用场景与选型建议

mailerlite/mailerlite-api-v2-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.8M 次下载、GitHub Stars 达 78, 最近一次更新时间为 2016 年 05 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 mailerlite/mailerlite-api-v2-php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 1.8M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 79
  • 点击次数: 23
  • 依赖项目数: 14
  • 推荐数: 0

GitHub 信息

  • Stars: 78
  • Watchers: 11
  • Forks: 46
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-05-16