goldnead/statamic-lead-magnets
A Statamic addon for creating lead magnets—gated downloads, checklists, and resources that collect visitor details before delivery. Define magnets in the control panel, embed capture forms in your templates, and manage leads without leaving Statamic.
Architecture fit: The package extends a Laravel application's lead magnet and delivery capabilities through a modular, addon-friendly architecture. The new Access delivery method uses a contract (Contracts\AccessSubjectResolver) that the host binds, keeping user/account creation and authentication outside the package—this is good separation of concerns. The Mail series feature integrates optionally with an automations addon via a bridge that reads its repository and run history, aligning with Laravel's event-driven patterns. The DeliveryVariables event allows listeners to extend placeholders without subclassing, fitting Laravel's event system. The webhook notification and signed-download 404 behavior are small, isolated changes. Overall, the architecture fits well with a Laravel ecosystem that already uses related addons, with low architectural risk if the host app follows standard Laravel conventions.
Integration feasibility: Upgrading is low-effort: one migration adds three nullable columns to lead_magnet_resources (access_product, access_path, delivery_series), so existing resources are unaffected. Optional config adds notifications.* and entitlements.access_source. Adopting Access delivery requires implementing and binding the AccessSubjectResolver contract; without it, the feature cannot be used. Mail series requires the automations addon and a configured automation; it gracefully falls back to the delivery mail when the addon is absent, disabled, or the reader already had the series. DeliveryVariables is opt-in via listeners. Webhook notification is opt-in via config. Feasibility is high, but full feature leverage depends on whether the host already uses the entitlements and automations addons.
Technical risk: Low to moderate. Key risks: (1) Access delivery depends on a host-implemented resolver; incorrect implementation could grant access to the wrong account or create duplicate accounts. (2) The Mail series bridge reads automations' internals, so version drift between packages could break the integration. (3) Webhook notifications post every request to a Discord-compatible endpoint, raising privacy/compliance concerns if request data contains sensitive information; payload filtering, TLS, and endpoint security must be reviewed. (4) The signed-download 404 change is likely a security fix but could confuse API clients expecting a different status. (5) Migration is nullable and low-risk. Overall, risks are manageable with code review, version pinning, and configuration review.
Key questions:
AccessSubjectResolver safely (race conditions, idempotency, account lookup)?DeliveryVariables provide sufficient context (reader, resource, delivery method) for listeners to add placeholders safely?Stack fit: The package targets Laravel applications and fits naturally with Eloquent, Blade, service container bindings, events, and config-driven features. The new Access method uses a contract binding—standard Laravel—and the Mail series bridge piggybacks on the automations addon. The webhook and 404 changes are framework-agnostic. TPM should confirm the application's Laravel version and that the related addons (automations, entitlements) are already in the stack or planned.
Migration path: Run composer update to v3.12.0, then php artisan migrate to add nullable columns. Publish optional config if using notifications or entitlements. Implement and bind AccessSubjectResolver in a service provider only if Access delivery will be used. Enable the automations addon and configure delivery_series per resource for Mail series. Add DeliveryVariables listeners as needed. Set notifications.webhook_url for webhook notices. The signed-download 404 change requires no action but should be documented. All steps are incremental and can be performed in phases.
Compatibility: Backward compatible for existing file-based lead magnets; new fields remain null and existing behavior is unchanged. The 404 change is a behavioral change for clients but is a security improvement; it should be treated as a minor breaking change for API consumers and documented accordingly. The optional automations bridge should be pinned to compatible versions. No conflicts with existing features are expected.
Sequencing:
AccessSubjectResolver if Access delivery is in scope.DeliveryVariables listeners for extended placeholders.Maintenance: Low routine maintenance. The package is actively maintained, and the new features are additive and optional. Ongoing effort is mainly keeping the automations addon compatible if the bridge is used, and maintaining the host-owned AccessSubjectResolver implementation. Webhook monitoring may require alerts for delivery failures.
Support: Support documentation should cover the Access contract, Mail series configuration and fallback behavior, DeliveryVariables usage, webhook payload contents, and the 404 change. Support staff may need training on new delivery options and how to troubleshoot resolver errors. The 404 change should be added to release notes and API changelogs.
Scaling: Access delivery adds host-controlled account resolution, which may introduce extra DB lookups; performance depends on the resolver implementation. The webhook feature adds an external HTTP call per request—if synchronous, it could become a bottleneck under load or when the endpoint is slow/unavailable. Prefer queueing webhook dispatches with retries. Mail series scaling depends on the automations addon. The nullable migration has no query performance impact. Overall, scaling is manageable with proper queue and resolver design.
Failure modes:
AccessSubjectResolver throws or returns null: user may not receive access; log and handle gracefully.DeliveryVariables listener errors: could break delivery emails if uncaught; listeners should be isolated and logged.Ramp-up: Developers familiar with Laravel can upgrade and use existing file delivery within hours. Adopting Access delivery requires understanding the contract and host implementation—allow 1–2 days for design and testing. Fully leveraging Mail series and the automations bridge may take 1–2 weeks depending on familiarity with the addon ecosystem. Webhook and DeliveryVariables are quick wins. TPM should allocate time for documentation review, privacy review of the webhook, and cross-team coordination with the automations/entitlements owners.
How can I help you explore Laravel packages today?