mailoptin/mailchimp-api-php
Composer 安装命令:
composer require mailoptin/mailchimp-api-php
包简介
PHP library for v3 of the MailChimp API
关键字:
README 文档
README
This library provides convenient wrapper functions for Mailchimp's REST API. The API is documented here.
Requirements
Installation
Dependencies are managed by Composer. After installing Composer, run the following command from the library root:
composer install --no-dev --ignore-platform-reqs
Or to install with phpunit:
composer install
Usage
Get your account information
A basic test to confirm the library is set up and functional.
<?php require 'PATH_TO_LIBRARY/mailchimp-api-php/vendor/autoload.php'; $api_key = 'YOUR_API_KEY'; $mailchimp = new Mailchimp\Mailchimp($api_key); // Get the account details of the authenticated user. $response = $mailchimp->getAccount(); // Output the account details. if (!empty($response) && isset($response->account_id)) { echo "ID: {$response->account_id}\n" . "Name: {$response->account_name}\n"; }
Get lists and their interest categories
A more complicated example that takes the response from one API call and uses that data to make another.
<?php require 'PATH_TO_LIBRARY/mailchimp-api-php/vendor/autoload.php'; $api_key = 'YOUR_API_KEY'; $mailchimp_lists = new Mailchimp\MailchimpLists($api_key); // Get all lists. $response = $mailchimp_lists->getLists(); if (!empty($response) && isset($response->lists)) { foreach ($response->lists as $list) { // Output the list name. echo "List name: {$list->name}\n"; // Get the list's interest categories. $interests = $mailchimp_lists->getInterestCategories($list->id); // Output the names of the list's interest categories. if (!empty($interests) && isset($interests->categories)) { foreach ($interests->categories as $category) { echo "Interest category: {$category->title}\n"; } } } }
Testing
This library includes a PHPUnit test suite.
Running PHPUnit tests
Add Composer's vendor directory to your PATH by adding the following line to your profile. This is dependent on your system, but on a Linux or Mac OSX system using Bash, you'll typically find the file at ~/.bash_profile.
export PATH="./vendor/bin:$PATH"
Bash example:
echo 'export PATH="./vendor/bin:$PATH"' >> ~/.bash_profile source ~/.bash_profile
Then run PHPUnit:
phpunit
Mailchimp API Playground
Mailchimp's API Playground provides access to all API methods via a web-based UI. You can use this to test API calls and review data you've sent to Mailchimp.
mailoptin/mailchimp-api-php 适用场景与选型建议
mailoptin/mailchimp-api-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.04k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 08 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「mail」 「mailchimp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mailoptin/mailchimp-api-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mailoptin/mailchimp-api-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mailoptin/mailchimp-api-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Courier offers a convenient and painless solution for creating emails tailored for your Kirby website.
MailChimp OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Manage newsletters in Laravel
The Automated Provision of Email Services (APES) module will allow you to set up an automated sync mechanism between the SilverStripe Member DataObject and MailChimp.
Mail libraries used by Zimbra Api
Email+ extends Kirby's email capabilities by adding support for multiple email services using the same Kirby email API.
统计信息
- 总下载量: 1.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2021-08-05