mremi / dolist-bundle
Implementation of Dolist library for Symfony2
Installs: 487
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.3.3
- mremi/dolist: dev-master
- symfony/framework-bundle: ~2.1
This package is auto-updated.
Last update: 2024-11-27 00:15:53 UTC
README
This bundle implements the Dolist library for Symfony2.
License
This bundle is available under the MIT license.
Prerequisites
This version of the bundle requires Symfony 2.1+.
Basic Docs
Installation
Installation is a quick 3 step process:
- Download MremiDolistBundle using composer
- Enable the Bundle
- Configure the MremiDolistBundle
Step 1: Download MremiDolistBundle using composer
Add MremiDolistBundle in your composer.json:
{ "require": { "mremi/dolist-bundle": "dev-master" } }
Now tell composer to download the bundle by running the command:
$ php composer.phar update mremi/dolist-bundle
Composer will install the bundle to your project's vendor/mremi
directory.
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Mremi\DolistBundle\MremiDolistBundle(), ); }
Step 3: Configure the 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.
# 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
Add/update a contact
Two services allow you to add or update a contact, to use like this:
<?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()); }
Retrieve contacts
<?php use Mremi\Dolist\Contact\GetContactRequest; $contactManager = $container->get('mremi_dolist.api.contact_manager'); $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! :)