industrious-mouse / laravel-dotmailer
Laravel wrapper for the dotmailer-api-v2-client library (https://github.com/romanpitak/dotmailer-api-v2-client)
Installs: 3 006
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 5
Open Issues: 0
Requires
- php: >=5.3.0
- romanpitak/dotmailer-api-v2-client: ~1.1
This package is auto-updated.
Last update: 2024-10-29 05:04:35 UTC
README
A very basic Laravel wrapper for the Dotmailer API Client by romanpitak.
Installation
To install, inside your project directory run the following from your terminal:
composer require industrious-mouse/laravel-dotmailer
Then load the service provider in your config/app.php:
IndustriousMouse\LaravelDotmailer\LaravelDotmailerServiceProvider::class
You'll also need to publish the config, so you can provide your keys:
php artisan vendor:publish --provider="IndustriousMouse\LaravelDotmailer\LaravelDotmailerServiceProvider"
Examples
Adding a Contact with custom data fields.
$contact_data = new ApiContact([
'email' => 'test@test.com',
'emailType' => 'Html',
'dataFields' => [
[
'key' => 'FIRSTNAME',
'value' => 'Name'
]
]
]);
try
{
$contact = Dotmailer::PostContacts($contact_data);
}
catch (Exception $e)
{
return $e;
}
Sending a Campaign to a contact
$contact_id = 12345;
$campaign_id = 12345;
$data = [
'CampaignId' => $campaign_id,
'ContactIds' => [
$contact_id
]
];
$send = Dotmailer::PostCampaignsSend(new ApiCampaignSend($data));
try
{
$contact = Dotmailer::PostContacts($contact_data);
}
catch (Exception $e)
{
return $e;
}