Skip to content

PHP client library for the dotMailer v2 (REST) API with MULTIPLE ACCOUNTS SUPPORT!

License

Notifications You must be signed in to change notification settings

RailsGuy/dotMailer-API-v2-PHP-client

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dotMailer API v2 PHP client

(c) 2014 Roman Piták, http://pitak.net [email protected]

PHP client library for the dotMailer v2 (REST) API with multiple accounts support!

Full implementation according to the http://api.dotmailer.com/v2/help/wadl

Type hinting support for objects and resources (not yet for arrays).

Single account usage

<?php

	$credentials = array(
		'username' =>  '[email protected]',
		'password' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'
	);

	$resources = Container::newResources($credentials);

	echo $resources->GetAccountInfo();

?>

Multiple accounts usage

<?php

	$credentials = array(
		'master' => array(
			'username' =>  '[email protected]',
			'password' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'
		),
		'group1' => array(
			'g1-account1' => array(
				'username' =>  '[email protected]',
				'password' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'
			),
			'g1-account2' => array(
				'username' =>  '[email protected]',
				'password' => 'YYYYYYYYYYYYYYYYYYYYYYYYYYY'
			)
		)
	);

	$container = Container::newContainer($credentials);

	echo $container->getResources('master')->GetSegments();

	$dataField = new ApiDataField();
	$dataField->name = 'MY_DATA_FIELD';
	$dataField->type = ApiDataTypes::STRING;
	$dataField->visibility = ApiDataFieldVisibility::HIDDEN;

	foreach ($container->group1 as $resources) {
		try {
			$resources->PostDataFields($dataField);
			echo 'OK';
		} catch (Exception $e) {
			echo 'Already exists';
		}
	}

?>

TODO

Refactor Simple data types

Split IResources into sub-interfaces

Interfaces for data types

About

PHP client library for the dotMailer v2 (REST) API with MULTIPLE ACCOUNTS SUPPORT!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%