Skip to content

Core Concepts

Contacts runs lazily ('autoload' => false, 'singular' => true) and stores all directory records in Entries with zero custom SQL tables. Resolve the service via Contacts::instance($this) or Contacts::requireInstance($this).

flowchart TB
  Org["OrganizationEntry\n(contacts-organizations)"] <-->|"Pivot: contacts-membership"| Contact["ContactEntry\n(contacts-contacts)"]
  Contact --> Channels["contacts-channel\n(9 ChannelTypes)"]
  Contact --> Addresses["contacts-address\n(7 AddressTypes)"]
  Contact --> Consents["contacts-consent\n(5 ConsentPurposes)"]
  Contact --> Notes["contacts-notes\n(Timeline & Follow-Ups)"]
  Contact --> Taxonomy["contacts-roles & contacts-tags"]
  Contact -.->|"contactsParticipant hooks"| Downstream["Downstream Modules\n(Merge · Timeline · GDPR)"]
Constant Blueprint Handle Kind Visibility Purpose
TYPE_SETTINGS contacts-settings single Hidden Global defaults, dedupe strategy, sync toggles, retention window (revisions: 10).
TYPE_CONTACTS contacts-contacts collection Hidden People records hydrated as ContactEntry (revisions: 15, 7 editor tabs).
TYPE_ORGANIZATIONS contacts-organizations collection Hidden Companies, agencies, brokerages, suppliers hydrated as OrganizationEntry (revisions: 15, 7 tabs).
TYPE_NOTES contacts-notes collection Hidden Interaction notes and scheduled follow-ups (revisions: 10, sluggable: false, sort -occurred_at).
TYPE_ROLES contacts-roles collection Hidden Vertical directory roles (unique code, such as broker, crew, lead).
TYPE_TAGS contacts-tags collection Hidden Canonical segmentation tags (unique code, color swatch) synced with import/export groups.
TYPE_CHANNEL contacts-channel block Hidden Repeatable communication channels (ChannelType), RBAC-gated.
TYPE_ADDRESS contacts-address block Hidden Repeatable addresses (AddressType) with billing/shipping defaults, RBAC-gated.
TYPE_CONSENT contacts-consent block Hidden Append-only purpose-scoped consent ledger (ConsentPurpose), contacts-admin delete.
TYPE_MEMBERSHIP contacts-membership block Hidden Pivot memberships linking contacts to organizations with role/department/primary flag.
FIELDSET_PROFILE contacts-profile fieldset Public Composable user/page profile fieldset (contacts_profile preset).
FIELDSET_ORGANIZATION contacts-organization fieldset Public Composable organization fieldset (contacts_organization preset).
FIELDSET_MEMBERSHIPS contacts-memberships fieldset Public Composable memberships fieldset (contacts_memberships preset).

Both ContactEntry and OrganizationEntry extend AbstractDirectoryEntry (which extends EntryItem), exposing typed read helpers without manual casting:

  • Shared (AbstractDirectoryEntry): displayTitle(), primaryEmail(), phoneE164(), countryCode(), timezone(), statusKey(), ownerUserId(), channels(), addresses(), primaryAddress(), defaultBillingAddress(), defaultShippingAddress(), roleCodes(), tagCodes(), domainMeta($key, $default), externalRef($key).
  • ContactEntry: salutation(), firstName(), lastName(), fullName(), jobTitle(), preferredLanguage(), isAnonymized(), doNotContact(), marketingOptIn(), linkedUserId(), primaryOrganization(), primaryOrganizationId(), memberships(), consents().
  • OrganizationEntry: legalName(), orgType(), website(), taxId(), taxOffice(), registrationNo(), billingEmail(), defaultCurrency(), paymentTermsDays(), parentOrganization(), parentOrganizationId().

ContactNormalizer hooks Entries::saveReady on both single save() and batch saveMany() operations so data stays consistent no matter where a write originates:

  • Lowercases and trims email addresses (normalizeEmail()).
  • Normalizes phone numbers to E.164 format using the record’s country or default_country_code (normalizePhone()).
  • Enforces at most one is_primary channel per type, one is_primary address, one is_default_billing address, and one is_default_shipping address.
  • Prevents circular parent_organization chains on organizations.
  • Synchronizes contacts-membership pivot rows with primary_organization.
  • Protects gdpr_anonymized_at, append-only contacts-consent writes, and trusted linked_user_id bindings behind scoped internal gates (runAsAnonymizer, runAsSystemConsentWriter, runAsUserLinker).

Next steps