Download the PHP package nubitio/tenant-bundle without Composer

On this page you can find all versions of the php package nubitio/tenant-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tenant-bundle

@nubitio/tenant-bundle

Read-only split of nubitio/nubit-symfony. Open issues and pull requests there. Commits here are overwritten on every split from main.

Opt-in multi-tenancy for Nubit Symfony apps: column mode (shared DB + Doctrine filter), database mode (per-tenant DSN), schema mode (PostgreSQL search_path), or hybrid routing, plus optional plan quota enforcement.

Install

Register the bundle and enable it when the app profile is saas or hybrid:

Pair with admin-bundle SaaS profile:

Column isolation (default)

Mark tenant-owned entities with #[TenantScoped] and implement TenantOwnedInterface. The Doctrine nubit_tenant filter scopes queries to the active tenant.

TenantOwnedInterface/TenantOwnedTrait live in nubitio/platform, so a package can declare its entities tenant-owned without requiring this bundle at all — the tenant_id column exists either way, and is only ever read or stamped once tenant-bundle is installed and configured. Import from Nubit\Platform\Tenant\... in new code; Nubit\TenantBundle\Contract\TenantOwnedInterface and Nubit\TenantBundle\Entity\TenantOwnedTrait still work as aliases of the platform originals.

Custom column + association stamping (RestoPOS pattern):

Users should implement TenantAwareUserInterface so the user resolver can populate TenantContext.

Database and hybrid isolation

Switch isolation: database to route every request to a tenant-specific database URL. For isolation: hybrid, the control-plane tenant entity chooses column or database per tenant via getIsolationMode(). Database targets must also expose getDatabaseUrl():

Configure the tenant connection wrapper:

control_plane_connection is used only for registry lookups; keep it on a control-plane entity manager, separate from the dynamically switched tenant_connection.

The default Nubit\TenantBundle\Entity\Tenant retains databaseUrl for compatibility with existing database-isolation deployments. New production applications should use a custom tenant entity whose getDatabaseUrl() resolves credentials from a dedicated control-plane secret store.

The bundle only routes an already-provisioned target. Database creation, credentials, grants, migrations, queues, and provider SDKs remain application-owned.

PostgreSQL schema isolation

isolation: schema derives the tenant schema exclusively from the positive resolved tenant ID: with the default schema_prefix: tenant_, tenant ID 42 becomes tenant_42. Slugs, domains, request headers, and target-provider strings are never used as SQL identifiers.

The schema switcher validates lowercase PostgreSQL identifiers (allowed characters and the 63-byte limit), executes SET search_path TO "tenant_42", "public", "extensions", and explicitly restores SET search_path TO "public", "extensions" after the HTTP request. It rejects switching or resetting while a transaction is active; it never uses SET LOCAL or bare RESET.

For isolation: hybrid, an application-owned TenantIsolationTargetProviderInterface may return new TenantIsolationTarget(TenantIsolationTarget::SCHEMA). The bundled registry provider intentionally rejects schema targets, so applications must own the placement decision. Column and database hybrid targets remain compatible.

TenantSchemaProvisionerInterface and TenantSchemaMigrationRunnerInterface are documentation markers only. Applications own schema creation, roles/grants, migrations, backups, and secret retrieval; this bundle supplies neither DDL nor provider credentials.

Plan quotas

Enable quotas_enabled: true to block prePersist when a plan limit is reached. Limits come from FeatureCheckerInterface::getFeatureConfig($resource)['max'].

  1. Tag entities with the quota resource name:

  2. Register usage counters via QuotaUsageProviderInterface (autoconfigured with tag nubit.quota_usage_provider):

When quotas_enabled is on, the bundle aliases QuotaEnforcerInterface to FeatureQuotaEnforcer (replacing admin-bundle's unlimited noop for SaaS apps).

Commands

Per-tenant console jobs extend Nubit\Platform\Symfony\Console\PerTenantCommand — the bundle wires the connection switcher and a Doctrine-backed registry.

Resolution strategies

Strategy Source
user TenantAwareUserInterface on the authenticated user
jwt_claim tenantId / tenantName claims in the access JWT
header X-Tenant-Id (configurable)
subdomain Tenant registry lookup by slug / domain

All versions of tenant-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
doctrine/doctrine-bundle Version ^3.2
doctrine/orm Version ^3.0
firebase/php-jwt Version ^7.0
nubitio/platform Version ^1.0
symfony/config Version ^7.4 || ^8.0
symfony/console Version ^7.4 || ^8.0
symfony/dependency-injection Version ^7.4 || ^8.0
symfony/doctrine-bridge Version ^7.4 || ^8.0
symfony/framework-bundle Version ^7.4 || ^8.0
symfony/http-foundation Version ^7.4 || ^8.0
symfony/http-kernel Version ^7.4 || ^8.0
symfony/security-core Version ^7.4 || ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nubitio/tenant-bundle contains the following files

Loading the files please wait ...