industrious-mouse / laravel-dotmailer by industrious-mouse

Laravel wrapper for the dotmailer-api-v2-client library (https://github.com/romanpitak/dotmailer-api-v2-client)
3,006
6
3
Package Data
Maintainer Username: industrious-mouse
Maintainer Contact: support@industriousmouse.co.uk (Christian Thomas)
Package Create Date: 2014-11-20
Package Last Update: 2018-10-31
Home Page:
Language: PHP
License: MIT
Last Refreshed: 2024-11-23 03:15:31
Package Statistics
Total Downloads: 3,006
Monthly Downloads: 65
Daily Downloads: 0
Total Stars: 6
Total Watchers: 3
Total Forks: 5
Total Open Issues: 0

Laravel Dotmailer

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