for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Easychimp;
use Mailchimp\Mailchimp;
class Easychimp
{
/** @var Mailchimp */
protected $api;
public function __construct(Mailchimp $api)
$this->api = $api;
}
/**
* @param $id
*
* @return \Easychimp\MailingList
*/
public function mailingList($id)
return new MailingList($this->api, new Support(), $id);
* Determine if an API key is valid
* @throws InvalidApiKey
* @throws \Exception
public function validateKey()
try {
$this->api->get('');
} catch (\Exception $e) {
if (starts_with($e->getMessage(), '{')) {
$json = json_decode($e->getMessage());
if ($json->status == 401) {
throw new InvalidApiKey($json->detail);
throw $e;