Skip to content

mremi/Dolist

Repository files navigation

Dolist library

SensioLabsInsight

Build Status Total Downloads Latest Stable Version

This library allows you to interact with the API of Dolist CRM.

Basic Docs

Installation

Only 1 step:

Download Dolist using composer

Add Dolist in your composer.json:

{
    "require": {
        "mremi/dolist": "dev-master"
    }
}

Now tell composer to download the library by running the command:

$ php composer.phar update mremi/dolist

Composer will install the library to your project's vendor/mremi directory.

Add/update a contact

<?php

use Mremi\Dolist\Authentication\AuthenticationManager;
use Mremi\Dolist\Authentication\AuthenticationRequest;
use Mremi\Dolist\Contact\ContactManager;
use Mremi\Dolist\Contact\FieldManager;

$contactSoapClient = new \SoapClient('http://api.dolist.net/v2/ContactManagementService.svc?wsdl', array(
    'soap_version'       => SOAP_1_1,
    'trace'              => true,
    'connection_timeout' => 2,
    // ...
));
$authSoapClient = new \SoapClient('http://api.dolist.net/v2/AuthenticationService.svc?wsdl', array(
    'soap_version'       => SOAP_1_1,
    'trace'              => true,
    'connection_timeout' => 2,
    // ...
));
$authRequest = new AuthenticationRequest('YOUR_ACCOUNT_IDENTIFIER', 'YOUR_AUTHENTICATION_KEY');
$authManager = new AuthenticationManager($authSoapClient, $authRequest, 3);

$contactManager = new ContactManager($contactSoapClient, $authManager, 3);
$fieldManager   = new FieldManager;

$contact = $contactManager->create();
$contact->setEmail('[email protected]');
$contact->addField($fieldManager->create('firstname', 'Firstname'));
$contact->addField($fieldManager->create('lastname', 'Lastname'));

$ticket = $contactManager->save($contact);

$saved = $contactManager->getStatusByTicket($ticket);

if ($saved->isOk()) {
    // contact has been saved...
} else {
    // something is wrong...
    echo sprintf('Returned code: %s, description: %s', $saved->getReturnCode(), $saved->getDescription());
}

Retrieve contacts

<?php

use Mremi\Dolist\Contact\GetContactRequest;

$request = new GetContactRequest;
$request->setOffset(50);
// ...
$contacts = $contactManager->getContacts($request);
// ...

Contribution

Any question or feedback? Open an issue and I will try to reply quickly.

A feature is missing here? Feel free to create a pull request to solve it!

I hope this has been useful and has helped you. If so, share it and recommend it! :)

@mremitsme

About

A PHP library to interact with the API of Dolist CRM

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages