Skip to content

5-Minute Quickstart

This walkthrough creates the Aegean Voyages (aegeanvoyages.example) charter brokerage directory using the same real-world entities shown in site/modules/Contacts/examples/real-world/.

  1. Configure directory defaults

    Open Setup -> Contacts -> Settings:

    • Under General, set Default Country (TR), Default Currency (EUR), Default Language (en), and Duplicate Matching (Email first, then E.164 phone fallback).
    • Under Privacy & Sync, review Capture from Forms, Sync Portal Accounts, Send Outbound Webhooks, and Retention (Days), then click Save.
  2. Create roles, tags, an organization, and a deduplicated contact in PHP

    <?php
    declare(strict_types=1);
    namespace ProcessWire;
    use Totoglu\Contacts\Domain\ConsentPurpose;
    $contacts = Contacts::requireInstance($this);
    // Ensure canonical roles and segmentation tags idempotently
    $contacts->ensureRole('broker', ['title' => 'Charter Broker']);
    $contacts->ensureTag('vip', ['title' => 'VIP']);
    $contacts->ensureTag('aegean-2026', ['title' => 'Aegean 2026']);
    // Deduplicated organization upsert
    $orgResult = $contacts->findOrCreateOrganization([
    'title' => 'Riviera Yacht Brokerage',
    'legal_name' => 'Riviera Yacht Brokerage SAS',
    'org_type' => 'brokerage',
    'tax_id' => 'FR84912034512',
    'default_currency' => 'EUR',
    'country_code' => 'FR',
    ]);
    $org = $orgResult['organization'];
    // Deduplicated contact upsert
    $result = $contacts->findOrCreateContact([
    'title' => 'Claire Beaumont',
    'first_name' => 'Claire',
    'last_name' => 'Beaumont',
    'primary_email' => '[email protected]',
    'phone_e164' => '+33 4 93 55 01 06',
    'job_title' => 'Managing Broker',
    'primary_organization' => $org->id,
    'roles' => ['broker'],
    'tags' => ['vip', 'aegean-2026'],
    ], ['autoCreateTags' => true]);
    $contact = $result['contact'];
  3. Add a billing address, record marketing consent, and log a follow-up call

    <?php
    declare(strict_types=1);
    namespace ProcessWire;
    use Totoglu\Contacts\Domain\ConsentPurpose;
    // Ownership-verified default billing address
    $contacts->addresses()->upsertFor($contact, [
    'address_type' => 'billing',
    'line1' => '14 Promenade des Anglais',
    'city' => 'Nice',
    'postal_code' => '06000',
    'country_code' => 'FR',
    'is_default_billing' => true,
    'is_primary' => true,
    ]);
    // Append-only purpose-scoped consent
    $contacts->recordConsent($contact, ConsentPurpose::MarketingEmail, true, [
    'source' => 'broker_onboarding',
    'evidence' => 'privacy-policy-2026-v1',
    ]);
    // Log interaction with scheduled follow-up reminder
    $contacts->logInteraction([
    'title' => 'Confirmed July Gocek 12 Islands charter hold',
    'interaction_kind' => 'call',
    'contact_ref' => $contact->id,
    'organization_ref' => $org->id,
    'follow_up_at' => time() + 86400,
    'assigned_user_id' => $this->wire()->user->id,
    'body' => 'Client requested provisioning menu and crew profile PDF before Friday.',
    ]);
  4. Inspect the workspace and run contacts:doctor

    Open Setup -> Contacts -> Contacts, click Claire Beaumont to view her 7-tab editor, action bar, and timeline feed, and run:

    Terminal window
    php vendor/bin/wire contacts:doctor --json

Next steps