kikwik/referable-bundle
Symfony bundle for adding referral programs to Doctrine entities. It provides referable interfaces and traits, referral code and invite link generation, and tracking of referrer-to-referral relationships, making it easy to implement invite and reward workflows.
Install via Composer (composer require <vendor>/<package>) and let Laravel auto-discover the service provider. Publish the config (php artisan vendor:publish --tag=referer-config) and run migrations if the package persists referers. The first use case is capturing the HTTP referer on incoming requests: add the provided middleware to your web group, then resolve RefererManager from the container (now autowirable in v2.0.0) to read the referer for the current request. With v2.0.0, referer values are available immediately in the first request—no need to wait for a follow‑up request—so you can use them during initial page loads or API calls.
referers table via an Eloquent model.RefererManager in controllers, form requests, or services. It exposes methods to get the current referer, previous referer, or raw header value.laravel-doctrine/orm), listen to LifecycleEventArgs using the updated namespace (see Gotchas). This lets you attach referer data to entities on persist/update.Referer header when no session value exists.$this->mock(RefererManager::class) or set the Referer header on test requests. The v2.0.0 first‑request availability means you can assert referer values in the same request lifecycle.LifecycleEventArgs class namespace changed in v2.0.0. Update any custom event listeners or subscribers that type‑hint the old namespace (likely Doctrine\ORM\Event\LifecycleEventArgs → Doctrine\Persistence\Event\LifecycleEventArgs). Failing to do so will cause fatal errors.Referer header is client‑controlled. Sanitize or validate it before storing (e.g., check scheme/host) to avoid open‑redirect or XSS risks.Referer. Always handle null gracefully—the manager should return null rather than throwing.web group (after session start) so the manager has access to the session. If you need it in API routes, add it to the api group separately.enabled, store_in_session, or trusted_hosts. Disabling the middleware in tests may be necessary to avoid side effects.RefererManager in a service provider if you need to alter parsing logic, and you can extend the middleware to add custom storage drivers.How can I help you explore Laravel packages today?