linkage/sendgrid-marketing-campaign-api-client

simple php client for sendgrid marketing campaign apis

v1.2.0 2024-08-19 01:51 UTC

This package is auto-updated.

Last update: 2024-11-19 02:25:57 UTC


README

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
}