Skip to content

Contacts & Organizations

The core directory splits records into Contacts (contacts-contacts -> ContactEntry) and Organizations (contacts-organizations -> OrganizationEntry), connected by many-to-many Pivot Memberships (contacts-membership).

Open Setup -> Contacts -> Contacts to search, filter by role, tag, or status, toggle Table/Cards layouts, or export CSV/JSON/vCard files.

The Contacts directory supports Table and Cards views, saved filter views, live search, and multi-format export actions.

Clicking a contact opens the 7-tab Contact Editor (Identity, Organizations & Roles, Privacy, Settings at top, plus Channels, Addresses, Consents, and Notes inline panels below):

Each Contact record normalizes emails and E.164 phone numbers automatically and embeds Channels, Addresses, Consents, and Notes in one view.

Open Setup -> Contacts -> Organizations to manage companies, agencies, brokerages, suppliers, and parent-subsidiary trees.

Organizations store legal names, Tax/VAT IDs, billing emails, default currency, payment terms, and non-circular parent company links.

Totoglu\Contacts\Domain\OrganizationType defines 8 canonical types: company, agency, brokerage, supplier, partner, family_office, government, and other.

A single contact can belong to multiple organizations (for example, Claire Beaumont as Managing Broker at Riviera Yacht Brokerage and Advisory Board member at Mediterranean Fleet Operations). ContactNormalizer keeps primary_organization synchronized with the primary pivot membership row automatically, and blocks circular parent_organization chains on save.

Programmatic Lookup, Batching & Deduplicated Upsert

Section titled “Programmatic Lookup, Batching & Deduplicated Upsert”
<?php
declare(strict_types=1);
namespace ProcessWire;
$contacts = Contacts::requireInstance($this);
// Fast single lookups
$byEmail = $contacts->findContactByEmail('[email protected]');
$byPhone = $contacts->findContactByPhone('+33493550106', 'FR');
$byIdOrEmail = $contacts->getContact('[email protected]');
$byUser = $contacts->findContactByUser($this->wire()->user);
$org = $contacts->getOrganization('FR84912034512'); // UUID or Tax ID
// Batch hydration in caller order (avoids N+1 queries)
$batch = $contacts->getContactsByIds([$byEmail->id]);
// Bounded directory queries (default limit: 50)
$brokers = $contacts->findContacts('roles=broker, limit=25');
$orgs = $contacts->findOrganizations('org_type=brokerage, limit=25');
// Provision or link a contact for a logged-in ProcessWire user
$userContact = $contacts->ensureContactForUser($this->wire()->user);

Next steps