1. Go to this page and download the library: Download goldnead/statamic-leadhub library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// config/leadhub.php
'statuses' // available lead statuses
'default_status' // status assigned to new contacts
'overwrite_existing_fields_from_submissions' // never overwrite manually edited contacts (default: false)
'store_full_submission_payload' // attach raw submission to timeline
'timeline_payload_redaction' // sensitive keys redacted before storage
'exports.*' // queue threshold, target disk and directory
'features.*' // toggle features (attribution, crm_destinations, CRM-core modules)
'scoring.*' // fallback point table (see Lead scoring)
'click_tracking.*' // dedupe window and ignored query parameters
'notifications.*' // recipient e-mails, digest time (see Lead assignment)
'attribution.fields' // which submission fields map to UTM / referrer / landing page
'crm.destinations' // HubSpot / Brevo / webhook targets (see CRM connectors)
'email_normalization.*' // how an address is normalised before deduplication
'storage.*' // driver and, for `flat`, the content path
'notifications' => [
'enabled' => env('LEADHUB_NOTIFICATIONS', true), // the master switch
'recipients' => env('LEADHUB_NOTIFY_EMAILS'), // comma-separated team inbox(es)
'digest' => [
'enabled' => true,
'time' => env('LEADHUB_DIGEST_TIME', '08:00'), // server time, daily
],
],
'features' => [
'attribution' => true,
],
'attribution' => [
'fields' => [
'utm_source' => 'utm_source',
'landing_page' => 'landing_page',
// 'utm_campaign' => 'campaign', // ← map your own field name
],
],
LeadHub::ingest([...]); // resolve or create the contact first
LeadHub::recordRevenue(
'[email protected]',
'payments:payment:41', // namespaced by whoever contributes it
1900,
'EUR',
now(),
'statamic-payments',
);
LeadHub::refundRevenue('payments:payment:41', 400); // the RUNNING total, not one movement
LeadHub::revenueFor($contactId); // the ledger behind the totals
use Goldnead\Leadhub\Contracts\TimelineSource;
use Goldnead\Leadhub\Facades\LeadHub;
LeadHub::registerTimelineSource(new class implements TimelineSource { /* key(), available(), entries(), stats(), supersedes() */ });
use Goldnead\Leadhub\Crm\DestinationManager;
app(DestinationManager::class)->extend('salesforce', function (string $key, array $config) {
return new \App\Leadhub\SalesforceDestination($key, $config);
});
use Goldnead\Leadhub\Facades\LeadHub;
LeadHub::segments(); // [{ id, name, handle, is_active, members_count }, ...]
LeadHub::segmentMemberIds('qualified-leads'); // ['<contact-uuid>', ...] resolved LIVE from the rules
LeadHub::contactInSegment($contactOrId, 'qualified-leads'); // bool, cheap reactive check
use Goldnead\Leadhub\Events\LeadHubStatusChanged;
use Illuminate\Support\Facades\Event;
Event::listen(LeadHubStatusChanged::class, function (LeadHubStatusChanged $event) {
// $event->contact, $event->actor, $event->metadata
MyExternalSystem::sync($event->contact);
});