Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 791 Bytes

File metadata and controls

27 lines (21 loc) · 791 Bytes

simple php client for sendgrid marketing campaign apis

installation

composer require linkage/sendgrid-marketing-campaign-api-client

usage

$apiKey = 'get your api key from sendgrid admin screen';

$sendgridClient = new \Linkage\SendgridMarketingCampaignApiClient\Client(
    new \Linkage\SendgridMarketingCampaignApiClient\SendgridApiRequester($apiKey),
);
try {
    $sendgridClient->createContactList(
        new \Linkage\SendgridMarketingCampaignApiClient\ContactList\CreateContactListRequest('my new contact list'),
    );
} catch (\Linkage\SendgridMarketingCampaignApiClient\SendgridApiClientException $e) {
    // handle client error
} catch (\Linkage\SendgridMarketingCampaignApiClient\SendgridApiServerException $e) {
    // handle server error
}