MremiDolistBundle
, (*1)
, (*2)
This bundle implements the Dolist library for Symfony2., (*3)
License
This bundle is available under the MIT license., (*4)
Prerequisites
This version of the bundle requires Symfony 2.1+., (*5)
Basic Docs, (*6)
, (*7)
Installation
Installation is a quick 3 step process:, (*8)
- Download MremiDolistBundle using composer
- Enable the Bundle
- Configure the MremiDolistBundle
Step 1: Download MremiDolistBundle using composer
Add MremiDolistBundle in your composer.json:, (*9)
{
"require": {
"mremi/dolist-bundle": "dev-master"
}
}
Now tell composer to download the bundle by running the command:, (*10)
``` bash
$ php composer.phar update mremi/dolist-bundle, (*11)
Composer will install the bundle to your project's `vendor/mremi` directory.
### Step 2: Enable the bundle
Enable the bundle in the kernel:
``` php
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Mremi\DolistBundle\MremiDolistBundle(),
);
}
The bundle comes with a sensible default configuration, which is listed below.
However you have to configure at least your account identifier and
authentication key., (*12)
# app/config/config.yml
mremi_dolist:
api:
# mandatory
account_id: your_account_identifier
authentication_key: your_authentication_key
# optional, default values are:
authentication:
wsdl: http://api.dolist.net/v2/AuthenticationService.svc?wsdl
options:
soap_version: 1 # SOAP_1_1
proxy_host: ~
proxy_port: ~
proxy_login: ~
proxy_password: ~
compression: ~
encoding: ~
trace: %kernel.debug%
classmap: ~
exceptions: ~
connection_timeout: 2
typemap: ~
cache_wsdl: ~
user_agent: ~
stream_context: ~
features: ~
keep_alive: ~
retries: 1
# optional, default values are:
contact:
wsdl: http://api.dolist.net/v2/ContactManagementService.svc?wsdl
options:
soap_version: 1 # SOAP_1_1
proxy_host: ~
proxy_port: ~
proxy_login: ~
proxy_password: ~
compression: ~
encoding: ~
trace: %kernel.debug%
classmap: ~
exceptions: ~
connection_timeout: 2
typemap: ~
cache_wsdl: ~
user_agent: ~
stream_context: ~
features: ~
keep_alive: ~
retries: 1
, (*13)
Two services allow you to add or update a contact, to use like this:, (*14)
<?php
$contactManager = $container->get('mremi_dolist.api.contact_manager');
$fieldManager = $container->get('mremi_dolist.api.field_manager');
$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());
}
, (*15)
<?php
use Mremi\Dolist\Contact\GetContactRequest;
$contactManager = $container->get('mremi_dolist.api.contact_manager');
$request = new GetContactRequest;
$request->setOffset(50);
// ...
$contacts = $contactManager->getContacts($request);
, (*16)
Contribution
Any question or feedback? Open an issue and I will try to reply quickly., (*17)
A feature is missing here? Feel free to create a pull request to solve it!, (*18)
I hope this has been useful and has helped you. If so, share it and recommend
it! :), (*19)
@mremitsme, (*20)