Skip to content

HostRouting ​

Facade: Unusualify\Modularous\Facades\HostRouting
Accessor: unusualify.hosting
Underlying: Unusualify\Modularous\Support\HostRouting

Provides host-based (subdomain / domain) routing introspection and management. Works alongside HostableMiddleware for multi-tenant subdomain scenarios.

Methods ​

MethodSignatureDescription
getHost(): stringReturns the full current host (e.g. tenant.app.test)
getSubdomain(): stringReturns the subdomain portion
getDomain(): stringReturns the root domain
getTld(): stringReturns the TLD
isSubdomain(): boolWhether the current request is on a subdomain
isDomain(): boolWhether the current request is on the root domain
isTld(): boolWhether the current request matches the TLD
getRoutes(): arrayReturns all registered host routes
addRoute(string $host, string $action): voidRegisters a host → action mapping
removeRoute(string $host): voidRemoves a host route mapping

Notes ​

  • Used in conjunction with HostRoutingRegistrar — HostRouting is for introspection and resolving the current host, while HostRoutingRegistrar handles registration.
  • Pair with HostableMiddleware on routes that should be restricted to specific hosts.