vielhuber / ewshelper
Manage exchange contacts with a breeze.
1.1.3
2025-01-28 14:01 UTC
Requires
- php: >=5.6
- php-ews/php-ews: >=1.0
- vielhuber/stringhelper: >=1.0
- vlucas/phpdotenv: >=1.0
README
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.