truecastdesign/mailchimp

此库提供了一个简单的MailChimp API v3,用于将人们添加到邮件列表。

v1.0.1 2020-07-16 04:54 UTC

This package is auto-updated.

Last update: 2024-09-16 14:34:56 UTC


README

版本:v1.0.1

此库提供了一个简单的MailChimp API v3,用于将人们添加到邮件列表。

安装

使用composer安装

composer require truecastdesign/mailchimp

需要PHP 7.1或更高版本。

用法

以下是一个基本用法示例

从MailChimp获取您的API密钥和列表ID

状态选项是'pending',

# composer autoloader
require '/path/to/vendor/autoload.php';

$MailChimp = new \Truecast\MailChimp('kl32j4kl23jklj4l23j4kl23j34-us14');

$member = ['first_name'=>'John', 'last_name'=>'Doe', 'email'=>'johndoe@gmail.com'];

try {
	$MailChimp->add($member, 'listid123456', 'pending'); # member array, list id, status
	# success
	# display a notice or take them somewhere
} catch (\Exception $ex) {
	# failed
	trigger_error("We were not able to add you to our list. Error: ".$ex->getMessage(), 256);
}