Marketing automation system ESputnik.
A basic CURL wrapper for PHP (see http://php.net/curl for more information about the libcurl extension for PHP)
- PHP >= 5.4
- EXT-CURL = *
Add a line to your "require" section in your composer configuration:
{
"require": {
"ossbrownie/esputnik": "0.1.3"
}
}$eSputnik = new ESputnik(
new HTTPClient(
new CurlClient(),
new Config([
'login' => 'tester',
'password' => 'passwd'
])
)
);
{
$version = $eSputnik->version();
}
{
$contact = new Contact();
$contact
->setFirstName('FName')
->setLastName('LName')
->setContactKey('[email protected]');
$channelList = new ChannelList();
$channelList->add(new EmailChannel([
'value' => '[email protected]'
]));
$fieldList = new FieldList();
$fieldList
->add(new Field([
'id' => 12345,
'value' => 'CustomValue1',
]))
->add(new Field([
'id' => 12346,
'value' => 'CustomValue2',
]));
$contact
->setFieldList($fieldList);
$contact
->setChannelList($channelList);
$subscribe = new Subscribe();
$subscribe
->setFormType('test_type')
->getGroups()->add(new Group([
'name' => 'Test group'
]));
$response = $eSputnik->contactSubscribe($contact, $subscribe);
}
{
$addressbooks = $eSputnik->addressbooks();
}
{
$groups = $eSputnik->groups();
}
{
$params = new ParamList();
$params
->add(new Parameter([
'name' => 'EmailAddress',
'value' => '[email protected]',
]));
$eSputnik->event(new Event([
'eventTypeKey' => 'test-test',
'keyValue' => 'test-' . time(),
'params' => $params
]))
}To run the test suite, you need install the dependencies via composer, then run PHPUnit.
$> composer.phar install
$> ./vendor/bin/phpunit --colors=always --bootstrap ./tests/bootstrap.php ./testsHttpClient is licensed under the MIT License
Problems, comments, and suggestions all welcome: [email protected]