mjp91 / mailchimp-api-wrapper
Installs: 3 325
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >= 5.3.0
- guzzle/guzzle: 3.8.*
- symfony/event-dispatcher: ~3.4
Requires (Dev)
- phpunit/phpunit: 5.7.*
README
Lightweight wrapper library for MailChimp API
Example Usage
// 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(); }