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

Dynamic Subdomain Bundle Laravel Package

netgusto/dynamic-subdomain-bundle

Symfony bundle that brings dynamic subdomain routing to your app: define routes on wildcard hosts like {tenant}.example.com, match incoming subdomains automatically, and generate subdomain-aware URLs with minimal configuration.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit — poor, and the premise needs correcting. This is not a Laravel package. It is a Symfony2 bundle (netgusto/dynamic-subdomain-bundle), and bundles are a Symfony kernel concept with no Laravel equivalent. The package's job — inspect the incoming Host header, strip the base domain, resolve the remaining label to an entity, and make it available to the routing/controller layer — is genuinely useful, but in Laravel that capability is native: Route::domain('{tenant}.example.com') with route-model binding, plus a small middleware for canonicalization and container binding. We would be adopting a foreign framework's plumbing to solve a problem our own framework already solves.

Integration feasibility — low. There is no service provider, no publishable config, no facade, no Laravel-compatible namespace. Wiring it in would mean hand-porting the bundle's KernelEvents::REQUEST listener into Laravel middleware, translating Symfony's DI container assumptions, and replacing its routing integration with Laravel route groups. At that point the original code contributes a few dozen lines of host-parsing logic and nothing else.

Technical risk — high. Symfony 2.x has been end-of-life since 2018; the package's PHP constraints, autoloading conventions, and event system all predate modern PHP. Composer will almost certainly refuse to resolve it against a Laravel 10/11 stack on PHP 8.x, and forcing it with --ignore-platform-reqs in production is not a defensible choice. The adoption signals reinforce this: 14 stars, 0 dependents, an overall score of 0.23, and no apparent maintenance activity. We would be the sole maintainer of an abandoned dependency from day one. MIT licensing is the one clean element — it permits us to read and reimplement the logic legally.

Key questions for the team:

  1. What is the actual requirement — multi-tenant isolation, vanity subdomains, or customer-owned custom domains? Each has a different solution and a different cost profile.
  2. Is anyone on the team actually running Symfony 2.x, or was this surfaced by keyword search?
  3. Do we need only host→tenant resolution, or also per-tenant data isolation, queues, and migrations? The former is an afternoon of middleware; the latter is a tenancy framework.
  4. If the resolution heuristics are the appeal, which specific behaviors do we want to preserve?

Verdict: do not adopt as a dependency. Treat it as a design reference only.

Integration Approach

Stack fit — none for Laravel. The concept maps cleanly onto Laravel primitives, and we should build there rather than port. The target design: wildcard DNS (*.app.example.com) plus a TLS wildcard cert, a ResolveTenant middleware that parses $request->getHost(), validates the subdomain against reserved names, looks up the tenant through a cached resolver, and binds it into the container; then Route::domain('{tenant}.app.example.com') groups for the actual routes. URL generation via URL::defaults() or a custom URL generator keeps links tenant-scoped.

Migration path — reference, not transplant. Clone the repo, read the listener and the host-parsing utilities, and reimplement the parts we want in our own middleware with an MIT attribution comment if any code is copied verbatim. This is a one-to-two-day spike, not a migration project. If the real requirement is broader multi-tenancy, evaluate maintained packages — stancl/tenancy for database-per-tenant isolation, or spatie/laravel-multitenancy for a lighter model — rather than resurrecting this one.

Compatibility — blocking. Legacy PHP constraints and Symfony 2.x autoloading conflict with any modern Laravel release. There is no supported version matrix in which this package and our stack coexist.

Sequencing:

  1. Confirm the requirement and scope (days, not weeks) with the requesting stakeholder.
  2. Build a native Laravel proof of concept: wildcard DNS in a sandbox, middleware, route domain group, cached resolver, one integration test per failure mode.
  3. Decide build-vs-framework for tenancy based on whether isolation extends beyond routing.
  4. Retire the package from consideration; document the decision so it does not resurface.

Operational Impact

Maintenance — we would own it entirely. Zero dependents and no recent releases mean no upstream fixes, no CVE response, and no compatibility work for future PHP or framework versions. If code is vendored, it becomes our codebase and enters our patch cadence; if only the design is borrowed, the maintenance burden is the middleware we wrote, which is small and legible.

Support and ramp-up — low concept cost, non-trivial conventions cost. Subdomain routing is easy to explain and easy for a mid-level engineer to own. The friction is that any inherited Symfony2-era code carries unfamiliar idioms — bundle registration, event listeners, DI compiler passes — that add review overhead out of proportion to the code's size. Onboarding is a half-day for the native implementation; a day or more if we are reverse-engineering someone else's bundle.

Scaling — resolution is cheap; the surrounding infrastructure is not. Per-request host parsing is negligible. The costs that actually bite are a database or cache round-trip per request (mitigate with a Redis-backed tenant resolver keyed on host, including negative caching), and certificate management if tenants get custom domains — wildcard certs cover *.example.com but not customer.com, so that path needs ACME automation and a cert store.

Failure modes to design against explicitly:

  • Host header spoofing — never trust X-Forwarded-Host outside a configured trusted-proxy list; validate the subdomain against an allowlist pattern and reject on mismatch.
  • Reserved-subdomain collisions — www, api, admin, mail, app must be blocklisted at tenant creation, not at request time.
  • Unknown tenant behavior — decide deliberately between 404 and a marketing fallback, and cache the negative result.
  • Cookie and session leakage — scope session cookies host-only or per-tenant; a cookie set on .example.com is visible to every tenant.
  • Host canonicalization — case, trailing dots, and punycode/IDN need normalizing before lookup, or tenants will get intermittent 404s from some clients.
  • DNS wildcard misconfiguration — a missing * record fails everywhere at once; add a synthetic canary check to monitoring.

None of these are reasons to adopt the bundle; several are reasons to write the middleware ourselves where we can control the behavior.

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.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route