danplaton4/tenancy-bundle
Multi-tenancy for Symfony with zero boilerplate: resolve a tenant once per request and the kernel reconfigures DBAL/Doctrine, cache pools, mailer transport, and Messenger. Automatic query scoping and tenant propagation to workers; your app code stays tenant-unaware.
kernel.request listener) ensures seamless integration without requiring manual tenant context propagation in controllers or services.$tenantId parameters, leaked queries) by automating tenant resolution and subsystem reconfiguration (DB, cache, mailer, messenger). This reduces cognitive load for developers and minimizes risk of tenant isolation failures.stancl/tenancy, this bundle is Symfony-native, with deep integration into Doctrine, Messenger, Cache, and Mailer. The tag-based bootstrapper system (tenancy.bootstrapper) allows for extensibility without modifying core logic.composer require) + tenancy:install command handles bundle registration and config scaffolding. No manual DI wiring or complex migrations required for basic use cases.class_exists checks, enabling use in non-Doctrine Symfony apps.stancl/tenancy but with Symfony-specific optimizations (e.g., Origin resolver for SPAs).InteractsWithTenancy trait provides real SQLite tenant isolation per test, reducing flakiness in CI/CD pipelines.#[TenantAware] attribute simplifies query scoping, performance overhead (SQL filters) and edge cases (nested transactions, complex joins) may require tuning. The bundle’s strict mode mitigates this by failing fast on misconfigured queries.TenantStamp. However, custom transports may need additional bootstrappers.wrapperClass may not optimize connections as effectively as dedicated tools (e.g., PgBouncer, ProxySQL).tenancy:migrate command runs migrations per tenant, but large-scale deployments (10K+ tenants) may need parallelization or batch processing.landlord/tenant EntityManager setup could conflict with legacy Symfony apps using custom connection logic.TenantAwareFilter? Are there optimizations for read-heavy workloads?#[TenantAware] attribute and SQL filters. Works with Doctrine Migrations and custom entity listeners.TenantStamp propagation for async jobs. Supports sync/async transports and retries.tenancy:run command wraps any Symfony CLI tool (e.g., make:migration) with tenant context.InteractsWithTenancy trait integrates with PHPUnit, enabling real tenant isolation in tests.$tenantId parameters, custom query scopes).tenancy:install for one-shot setup and configure tenancy.yaml.#[TenantAware]).#[TenantAware].tenancy:run and InteractsWithTenancy.Origin header).#[TenantAware]).TenantContext service).tenancy.yaml (e.g., Host, Header, QueryParam).tenancy:run CLI command.tenancy:migrate for schema setup.#[TenantAware] to entities in shared-DB mode.InteractsWithTenancyHow can I help you explore Laravel packages today?