Getting Started

Introduction

laravel-go-tenancy adds multi-tenancy to Laravel Go applications.

It supports:

  • Multi-database tenancy (default): each tenant has its own database
  • Single-database tenancy (opt-in): shared schema with fail-closed tenant_id scoping

The package is built around three ideas:

  1. Identify a tenant from the HTTP request (domain, path, header, …)
  2. Initialize a request-scoped context for that tenant
  3. Bootstrap Laravel concerns (database, cache, filesystem, queue, session) so application code stays mostly unaware of tenancy

Unlike PHP runtimes that often mutate process-global state, this package stores the current tenant and connection on context.Context. That matches Laravel for Go’s context-first database and service APIs and stays safe under concurrent requests.