Skip to content

vielhuber/ewshelper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‡ ewshelper πŸ“‡

ewshelper is a little wrapper around php-ews and helps you manage your exchange contacts via php.
it can handle very big lists also helps you normalize your contacts data.

installation

install once with composer:

composer require vielhuber/ewshelper

then add this to your files:

require __DIR__ . '/vendor/autoload.php';
use vielhuber\ewshelper\ewshelper;
$ewshelper = new ewshelper('**host**', '**username**', '**password**');

usage

get all contacts

$ewshelper->getContacts();

get contact by id

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

normalize name and phones

$ewshelper->normalizeData();

remove duplicates

$ewshelper->removeDuplicates();

add a new contact

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

update a contact

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

remove a contact

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

sync contacts

the following helper function gets all exchange contacts in category test,
deletes those that are not present in the provided array and creates those that don't exist yet in exchange.

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

note on outlook

when deleting phone numbers or making a lot of changes to existing contacts,
it is recommended to use the function clear offline items.

About

πŸ“‡ Manage exchange contacts with a breeze. πŸ“‡

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages