- Can I install macpaw/postgres-schema-bundle in a Laravel application?
- It is a Symfony bundle, not a Laravel package. Laravel has no bundle lifecycle, so you cannot register it like a normal Composer package. You would need to extract the Postgres schema logic and wrap it in a Laravel service provider.
- What does macpaw/postgres-schema-bundle do for PostgreSQL schemas?
- It adds Symfony bundle configuration and Doctrine DBAL/ORM integration for selecting the active PostgreSQL schema. It manages search_path at runtime so entities and queries use the configured schema. It is aimed at schema-based multi-tenancy and per-tenant isolation without separate databases.
- How do I switch the active PostgreSQL schema per tenant or request?
- The bundle exposes runtime schema switching through search_path and Doctrine connection/listener support. In a Laravel port, you would need to wire that into the connection resolver and reset hooks. You must also reset schema state on transaction rollback and across queue/Octane boundaries.
- Is there a Laravel version of this package?
- No. The repository is packaged as a Symfony bundle with no Bundle class equivalent in Laravel. The TPM assessment says the reusable surface is Postgres DDL, search_path management, and console commands, not the Symfony wiring. A Laravel version would be a 2-4 engineer-week build project, not an install.
- How do I install and configure it?
- In Symfony, you install via Composer and register the bundle, then configure schemas and Doctrine connection settings. The config style is Symfony YAML/XML, not Laravel config array files. For Laravel, there is no direct install path; expect to write a provider and config file.
- Does it work with Doctrine in Laravel?
- Laravel only pulls doctrine/dbal for specific schema-introspection paths, not as a full data-access layer. This bundle assumes Doctrine connections, migrations, or event subscribers, so a Laravel adapter layer is needed rather than a shim. Do not expect Laravel Eloquent to use it transparently.
- What are the risks of using it in production?
- Zero stars and zero dependents means no community triage or third-party production usage to learn from. v2.0.8 is a targeted correctness fix for schema state not resetting on transaction rollback, which shows active maintenance but is only one data point. Technical risk remains high, especially around tenant-isolation boundaries and lifecycle resets.
- How is it maintained and is it actively developed?
- v2.0.8 was merged via a reviewed PR from a named maintainer with a versioned tag, so there is a working PR-and-release workflow. It is still effectively an unvetted single-vendor publish, and there is no evidence of external issue triage or internal MacPaw usage. Verify CI status and test coverage before a spike.
- What are the alternatives for PostgreSQL schema-per-tenant multi-tenancy in Laravel?
- stancl/tenancy and spatie/laravel-multitenancy are Laravel-native, have real adoption, and already solve search_path leaks in Octane and queue workers. The TPM assessment recommends an explicit written justification before choosing this zero-adoption third-party core over those packages or about two weeks of in-house DDL code. Compare total build and maintenance cost, not just license cost.
- How should I test tenant isolation and schema switching before adopting it?
- Start with a throwaway Symfony skeleton to learn the real API surface and confirm behavior. Then test the extracted Laravel implementation for transaction rollback, queue workers, Octane requests, and connection reuse, because search_path state can leak across those boundaries. Include tests that assert one tenant cannot read another tenant's schema, and verify CI coverage on the upstream repo.