Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Referral Rewriter Tag Laravel Package

the-3labs-team/laravel-referral-rewriter-tag

A Laravel package for rewriting referral tags on incoming requests, helping standardize referral attribution and preserve campaign tracking across redirects. Lightweight, configurable, and easy to drop into existing Laravel applications.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Requires PHP 8.2+ and is maintained against Laravel 12 via Testbench 10 in v1.0.6. Confirm your app meets that baseline before upgrading.
  • Install with Composer using the package name listed in the README/Packagist, then publish the package config so config/referral-rewriter-tag.php is available.
  • Start with config/referral-rewriter-tag.php. In v1.0.6 the optional instantgaming.subtag key was added, so this is the first place to configure or override the Instant Gaming referral subtag.
  • First use case: route outbound Instant Gaming links through the package’s rewriter/middleware so affiliate/referral tags are applied consistently without hand-editing URLs.
  • Look at the package boot smoke test and the Instant Gaming config fallback tests to confirm expected default behavior before wiring it into production routes.

Implementation Patterns

  • Keep referral tags config-driven. Put the default in config/referral-rewriter-tag.php and use environment-specific values via .env where appropriate, especially for instantgaming.subtag.
  • Apply rewriting narrowly. Use the package middleware/helper on routes that render affiliate links rather than globally, so internal, admin, and non-affiliate URLs are not accidentally rewritten.
  • Centralize outbound affiliate URL generation behind a helper, Blade component, or link builder. Let the package perform the final rewrite so controllers and views do not duplicate tag logic.
  • Exercise the fallback path in tests: omit instantgaming.subtag and assert the documented fallback default is used; then set an explicit subtag and assert it overrides the fallback.
  • For upgrades, run composer update, clear Laravel’s config cache, and run your application test suite. If you maintain a fork or copied CI, note that v1.0.6 removed standalone phpstan.yml and runs static analysis inside run-tests.yml.
  • Integrate with existing content/link workflows by testing representative Instant Gaming URLs, including URLs that already contain a subtag, URLs without one, and non-Instant Gaming links.

Gotchas and Tips

  • v1.0.6 is primarily a maintenance release, but it adds the instantgaming.subtag config key. Existing published config files may not contain it; merge or republish the config if you want explicit control.
  • The new fallback tests mean missing or empty instantgaming.subtag values may resolve to a default rather than remaining unset. Do not assume null/empty disables rewriting unless the package docs confirm it.
  • PHP 8.2 is now the local development and CI baseline. If your app is on PHP 8.1 or an older Laravel version, pin v1.0.5 or verify compatibility before upgrading.
  • After changing the subtag, run php artisan config:clear or php artisan optimize:clear. Cached config is the most common reason a new referral tag does not appear.
  • The Laravel 12/Testbench 10 baseline describes maintained CI coverage, not necessarily a hard runtime break for every older Laravel app. Treat older Laravel versions as unsupported unless you test them yourself.
  • The removal of standalone phpstan.yml only affects repository workflows. It does not change package runtime behavior, but forks or copied CI pipelines should update their references.
  • Debug by inspecting the final rendered URL, confirming the host matches Instant Gaming, checking the effective config value, and verifying the middleware/helper is actually applied to the route in question.
  • Extension points to watch: the published config file, the package service provider bindings, and any middleware alias or helper exposed by the package. Prefer config and middleware over patching vendor code.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels
wazza/laravel-db-encryption
hokny/laravel-generator
vonsogt/backup
jengo/queues
jeremykenedy/laravel-observability
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums