Dolist library
, (*1)
, (*2)
This library allows you to interact with the API of Dolist CRM., (*3)
Basic Docs, (*4)
, (*5)
Installation
Only 1 step:, (*6)
Download Dolist using composer
Add Dolist in your composer.json:, (*7)
{
"require": {
"mremi/dolist": "dev-master"
}
}
Now tell composer to download the library by running the command:, (*8)
``` bash
$ php composer.phar update mremi/dolist, (*9)
Composer will install the library to your project's `vendor/mremi` directory.
<a name="add-contact"></a>
## Add/update a contact
```php
<?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('test@example.com');
$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());
}
, (*10)
<?php
use Mremi\Dolist\Contact\GetContactRequest;
$request = new GetContactRequest;
$request->setOffset(50);
// ...
$contacts = $contactManager->getContacts($request);
// ...
, (*11)
Contribution
Any question or feedback? Open an issue and I will try to reply quickly., (*12)
A feature is missing here? Feel free to create a pull request to solve it!, (*13)
I hope this has been useful and has helped you. If so, share it and recommend
it! :), (*14)
@mremitsme, (*15)