PHP code example of vielhuber / ewshelper

1. Go to this page and download the library: Download vielhuber/ewshelper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vielhuber / ewshelper example snippets



use vielhuber\ewshelper\ewshelper;
$ewshelper = new ewshelper('**host**', '**username**', '**password**');

$ewshelper->getContacts();

$ewshelper->getContact('**id**');

$ewshelper->normalizeData();

$ewshelper->removeDuplicates();

$ewshelper->addContact([
    'first_name' => 'Max',
    'last_name' => 'Mustermann',
    'company_name' => 'Musterfirma',
    'emails' => ['[email protected]'],
    'phones' => ['private' => ['0123456789'], 'business' => ['9876543210']],
    'url' => 'https://www.mustermann.de',
    'categories' => ['test']
]);

$ewshelper->updateContact('**id**', [
    'first_name' => 'Max',
    'last_name' => 'Mustermann',
    'company_name' => 'Musterfirma',
    'emails' => ['[email protected]'],
    'phones' => ['private' => ['0123456789'], 'business' => ['9876543210']],
    'url' => 'https://www.mustermann.de',
    'categories' => ['test']
]);

$ewshelper->removeContact('**id**');

$ewshelper->syncContacts('test', [
    [
        'first_name' => 'Max',
        'last_name' => 'Mustermann',
        'company_name' => 'Musterfirma',
        'emails' => ['[email protected]'],
        'phones' => ['private' => ['0123456789'], 'business' => ['9876543210']],
        'url' => 'https://www.mustermann.de',
        'categories' => ['test']
    ],
    [
        'first_name' => 'Erika',
        'last_name' => 'Mustermann',
        'company_name' => 'Musterfirma',
        'emails' => ['[email protected]'],
        'phones' => ['private' => ['0123456789'], 'business' => ['9876543210']],
        'url' => 'https://www.mustermann.de',
        'categories' => ['test']
    ]
]);