Skip to content

Add-feature/Add-automatic-tenant-resolver#77

Merged
RamyHakam merged 3 commits intomasterfrom
feature/Add-automatic-tenant-resolver
Feb 14, 2026
Merged

Add-feature/Add-automatic-tenant-resolver#77
RamyHakam merged 3 commits intomasterfrom
feature/Add-automatic-tenant-resolver

Conversation

@RamyHakam
Copy link
Owner

This pull request introduces a comprehensive automatic tenant resolution system for multi-tenancy in Symfony applications, enabling seamless identification and switching of tenant contexts based on HTTP requests. The system supports multiple resolution strategies (subdomain, path, header, host, and chain), provides flexible configuration options, and integrates with the existing event-driven database switching mechanism. The most important changes are grouped below:

Automatic Tenant Resolution:

  • Added a new section in README.md documenting automatic tenant resolution, supported strategies, configuration examples, and custom resolver implementation.
  • Introduced TenantResolutionListener, an event subscriber that resolves the tenant from HTTP requests and dispatches SwitchDbEvent automatically.

Configuration and Dependency Injection:

  • Extended Configuration.php to support tenant resolver settings, including strategy selection, options for each strategy, and exclusion paths.
  • Updated HakamMultiTenancyExtension.php to register resolver services, configure the listener, and wire up strategy-specific resolvers based on user configuration. [1] [2]

Resolver Implementations:

  • Added AbstractTenantResolver as a base class for resolvers, providing common option handling and interface implementation.
  • Implemented concrete resolvers: ChainResolver (composite), HeaderResolver, HostResolver, and PathResolver, each extracting tenant information from different request parts. [1] [2] [3] [4]

@RamyHakam RamyHakam self-assigned this Feb 12, 2026
@RamyHakam RamyHakam added enhancement New feature or request v3 labels Feb 12, 2026
@RamyHakam RamyHakam merged commit 9d3731c into master Feb 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request v3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant