a2zwebltd/laravel-affiliate
Laravel Affiliate is a Laravel package for adding affiliate and referral tracking to your app. Generate affiliate links, attribute clicks and conversions, manage commissions, and support payout reporting with a simple, framework-native workflow.
Architecture fit. The package remains a conventional Laravel sidecar: service provider, config files, Blade/Livewire views, global attribution middleware, and a Registered event listener. Nothing in v1.3.0 changes that shape — the release is almost entirely about correctness of the view-publishing layer and hardening of statement/payout issuance. That is a good sign: the maintainer is fixing the seams where host applications override package behaviour rather than expanding the surface area. The addition of a dedicated IssuingEntity support class and IssuingEntityNotConfigured exception is welcome architecture — a named, catchable domain failure beats a silent write of a bogus legal entity onto a financial document.
Integration feasibility. Straightforward for a standard Laravel app: composer update, set AFFILIATE_STATEMENTS_ENTITY_CODE and AFFILIATE_STATEMENTS_LEGAL_NAME (plus address, country, company number, tax note), republish or move views, optionally adopt the new affiliate-views-blade / affiliate-views-livewire tags. Two things raise the effort estimate. First, published-view relocation is a manual filesystem move — trivial but stateful, and it only matters for teams that actually published views. Second, the issuing-entity change is behavioural, not just configuration: any code path that generates or issues a statement or completes a payout can now throw. If a host app wraps those calls in a job or batch, the exception needs handling, not just a config value.
Technical risk. The headline risk is that a minor version introduces a hard failure on a money-touching path. Defaults moving to null and payout completion checking before marking a request paid is the right safety posture, but it converts a latent data-quality bug into a runtime outage risk on upgrade day. The silent-view-override fix carries a second, subtler risk: teams that published views pre-1.3.0 were silently running package defaults, and their overrides will now start working on deploy. Any unmodified copies left in place become dead weight; any deliberately-edited copies may produce a visible output change on partner-facing statements with no other code change to blame. Third risk is documentation drift — the README corrections (automatic attribution via global middleware plus the Registered listener, no affiliate.capture alias, referral threshold counting all referrals) imply earlier integrators may have built against behaviour that never existed. Worth confirming no internal code depends on the phantom alias.
Key questions.
IssuingEntityNotConfigured is thrown at completion, or can it strand a request mid-transition?issuing_entity column defaults, or is this config-only?affiliate-integration skill additive only, or do they assume Boost is installed?Stack fit. Assumes Laravel with Blade and optionally Livewire; the new publish tags simply split the two view sources into the directories Laravel's override resolution expects. No new runtime dependencies. The Boost resources are inert unless the team runs Laravel Boost, so they are a no-cost option rather than a new platform requirement — though they are a reasonable on-ramp if the team already uses AI-assisted scaffolding.
Migration path. Sequence: (1) pin the current version and read the upgrade notes in full; (2) set the issuing-entity environment variables in every environment, including staging and preview/QA, before deploying the new version — the code/legal_name defaults are now null, so a deploy without them will fail on first statement generation; (3) audit and delete any config/affiliate_statements.php published from an older version, or strip its Acme defaults; (4) inventory resources/views/vendor/affiliate/{blade,livewire}/*, diff against package views, delete unmodified copies, move genuine customisations to resources/views/vendor/affiliate/* and resources/views/vendor/affiliate-livewire/*; (5) verify the partner statement renders using the now-shipped default before reintroducing overrides.
Compatibility. Config-driven and reversible for the view layer; the issuing-entity change is not reversible in the same way since the old placeholder defaults are deliberately removed. There is no data migration implied beyond the config file, but any partner-facing statement PDFs already issued under "Acme Ltd." are a legal/compliance artefact that predates the upgrade and should be flagged to whoever owns finance or compliance, not silently left in the archive.
Sequencing. Do the config work and view inventory in a single PR ahead of the version bump, so the deploy that introduces 1.3.0 is not also the deploy that changes environment configuration. Deploy to staging first and deliberately exercise the two paths that now throw: statement generation and payout completion. Only then promote to production, and prefer a window where a failed payout batch can be retried rather than one that coincides with a payout run.
Maintenance. Modest and net-positive. One config file to keep current, one exception class to handle, and a view-override directory that now behaves the way every other Laravel package does — which removes a long-standing class of "why isn't my customisation showing up" support tickets. The README corrections reduce the burden of tribal knowledge around attribution, though teams should re-read that section rather than trust their old integration notes.
Support. Expect a short spike in two ticket types: "statements stopped generating after upgrade" (missing env vars) and "statement layout changed after upgrade" (previously-ignored overrides now taking effect, or unmodified copies that should have been deleted). Both are resolvable with a documented runbook. The exception's error log entry is the key triage signal and should be surfaced in whatever alerting the team already uses rather than left in application logs.
Scaling. Unchanged. The attribution middleware is global, which is a per-request cost worth knowing about on high-traffic endpoints but has been in place since before this release. The referral-threshold semantics (counting all referrals) is now documented; if the team's reporting was built on a different assumption, reconcile the numbers before partners do.
Failure modes. Primary: IssuingEntityNotConfigured thrown during statement generation, issuance, or payout completion, blocking payouts by design. This is a fail-loud replacement for a fail-silent behaviour, which is the correct trade — an invalid legal entity on a financial statement is worse than a blocked payout — but it shifts the failure from "compliance discovers it later" to "on-call sees it now," so the alert must exist. Secondary: published view overrides suddenly activating and changing partner-facing output. Tertiary: stale config file from a prior version retaining Acme defaults, which the validator treats as still-unconfigured.
Ramp-up. Low for a Laravel developer: environment variables, one exception to catch, one directory convention. The real ramp-up cost is organisational — someone must own the legal entity values, confirm they are correct for the issuing jurisdiction, and accept that payouts will hard-stop until they are set. Budget a short compliance review, not a sprint.
How can I help you explore Laravel packages today?