industrious-mouse/laravel-dotmailer

Laravel wrapper for the dotmailer-api-v2-client library (https://github.com/romanpitak/dotmailer-api-v2-client)

0.2.1 2015-10-28 10:53 UTC

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;
}