https://github.com/mjp91/mailchimp-api-wrapper
Lightweight MailChimp API wrapper
https://github.com/mjp91/mailchimp-api-wrapper
mailchimp mailchimp-api mailchimp-api-wrapper php
Last synced: 3 months ago
JSON representation
Lightweight MailChimp API wrapper
- Host: GitHub
- URL: https://github.com/mjp91/mailchimp-api-wrapper
- Owner: mjp91
- Created: 2016-12-14T16:45:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-10-29T17:02:53.000Z (over 6 years ago)
- Last Synced: 2025-08-21T11:55:34.851Z (10 months ago)
- Topics: mailchimp, mailchimp-api, mailchimp-api-wrapper, php
- Language: PHP
- Size: 31.3 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MailChimp API Wrapper
Lightweight wrapper library for MailChimp API
## Example Usage
```php
// construct the request handler, passing in data centre, username and API key
$requestHandler = new \MailChimp\RequestHandler("us14", "you@example.com", "abc123");
// construct the request class for the API call, passing in any required URL parameters
$subscriberGet = new ReadSubscribers("4494d94b5a");
// optionally add a request body (if required by the API)
$requestBody = array("..." => "...");
$subscriberGet->setRequestBody($requestBody);
// send the request, returns an associative array
try {
$response = $requestHandler->handle($subscriberGet);
// $response->getHTTPCode();
// $response->getResponseBody();
} catch (RequestFailureException $ex) {
// a HTTP code returned indicating failure will cause an exception
$httpCode = $ex->getResponse()->getHttpCode();
$response = $ex->getResponse()->getResponseBody();
}
```