2017 © Pedro Peláez
 

library php-mailchimp

PHP client library for MailChimp API.

image

lorddashme-php-packages/php-mailchimp

PHP client library for MailChimp API.

  • Tuesday, April 24, 2018
  • by lorddashme
  • Repository
  • 2 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 40 % Grown

The README.md

PHP MailChimp

A PHP package wrapper for MailChimp API., (*1)

This package support only the version 3 of Mailchimp API., (*2)

Latest Stable Version Minimum PHP Version Coverage Status, (*3)

Requirement(s)

  • PHP version from 5.6.* up to latest.

Install

  • It is advice to install the package via Composer. Use the command below to install the package:
composer require lorddashme/php-mailchimp

Usage

  • Below are the available functions:
Function Description
post('route', closure/array); To request in the MailChimp API service using POST method. The body parameter accepts Cloure or Array type.
get('route'); To request in the MailChimp API service using GET method.
patch('route', closure/array); To request in the MailChimp API service using PATCH method. The body parameter accepts Cloure or Array type.
delete('route'); To request in the MailChimp API service using DELETE method.
action('route'); To request in the MailChimp API service using the custom ACTION.
getRequest(); To check the current request details. Can be use for debugging purposes.
getRespose(); To get the current response from the MailChimp API service.
Response Format:
{"response_body": {...}", "header": {"response_http_code": ...}}
  • Basic usage:
<?php

include __DIR__  . '/vendor/autoload.php';

use LordDashMe\MailChimp\MailChimp;

$apiKey = 'abcde12345...';

$mailchimp = new MailChimp($apiKey);

$listId = 'qwerty12345...';

$mailchimp->post("list/{$listId}/members", function ($requestBody) {
    $requestBody->email_address = 'sample_email@mailchimp.com';
    return $requestBody;
});

// If you want to investigate the current request details.
$mailchimp->getRequest();

// To get the response from the MailChimp API service.
// Response: {"response_body": {...}", "header": {"response_http_code": ...}}
$response = $mailchimp->getResponse();
  • Also can be done by using the below code:
<?php

include __DIR__  . '/vendor/autoload.php';

use LordDashMe\MailChimp\Facade\MailChimp;

$apiKey = 'abcde12345...';

MailChimp::init($apiKey);

$listId = 'qwerty12345...';

MailChimp::post("list/{$listId}/members", array(
    'email_address' => 'sample_email@mailchimp.com'
));

MailChimp::getRequest();

// Response: {"response_body": {...}", "header": {"response_http_code": ...}}
$response = MailChimp::getResponse();

License

This package is open-sourced software licensed under the MIT license., (*4)

The Versions

24/04 2018

dev-master

9999999-dev https://github.com/lorddashme-php-packages/php-mailchimp

PHP client library for MailChimp API.

  Sources   Download

MIT

The Requires

  • php >=5.6 || >=7.0 || >=7.1

 

The Development Requires

mail mailchimp github

20/02 2018

v2.0.0

2.0.0.0 https://github.com/lorddashme-php-packages/php-mailchimp

PHP client library for MailChimp API.

  Sources   Download

MIT

The Requires

  • php >=5.6 || >=7.0 || >=7.1

 

The Development Requires

mail mailchimp github