Skip to content

Full v4 changelog

Version 4 brings many new features, with the most important ones being:

  • Jetstream/Fortify support
  • Early identification and a general overhaul of routing logic
  • New tenancy bootstrappers

If you’re upgrading from v3, the main changes that will affect you are:

  • Namespace changes (mostly database-related things being moved to a dedicated namespace). These are easily resolved with any modern IDE
  • New config structure. You will have to delete and republish it (and then re-apply your changes, if any). It’s recommended to also do this with the TenancyServiceProvider
  • Several static properties being removed and replaced with config keys
  • Changes to routing logic (if you’re using universal routes)

Diff: d0de09a...master

New features

  • Tenant schema dump (tenants:dump) command 7d98ebb #807 a1a976c #985 cb7567a #1015 ea19117 #1019 f851288
  • Add Microsoft SQL Server support cc6d4fe #715
  • Add ScoutTenancyBootstrapper f83504a #936
  • Set default value for tenant URL parameters when a tenant is identified by path f2c6408 #925
  • Make tenants:run handle stdin prompts from subcommands 409190f #923
  • Add optional DeleteTenantStorage listener ab5fa7a #938
  • Add BatchTenancyBootstrapper b78320b #874
  • Add Storage::url() support 7bacc50 #909 a7ad828 222bbe4
  • Add tenant-specific maintenance mode 121370e #761
  • Add current() and currentOrFail() tenant methods 42dab29 #970
  • Add option for dropping tenant databases on migrate:fresh 080b271 #971 9520cbc #1007
  • Add maintenance mode events 3f60c4a #979
  • Add cookie option on InitializeTenancyByRequestData 05f1b2d #980
  • Add pending tenants1 198f34f #869 7d3298c #1025
  • Add DatabaseSessionBootstrapper (adds support for database session driver) 5849089
  • Add session state when impersonating tenant f42f08c #1029
  • Add a dedicated feature for tenant-specific mail credentials 0f892f1 #989 ea5a746
  • Add skip-failing option to tenants:migrate command 342c67f #945
  • Allow defining the tenant connection template using array syntax 087733d #1040
  • Add RootUrlBootstrapper (changes APP_URL in CLI context, used e.g. when sending emails in queued jobs that should have links to the tenant’s domain) 617e9a7 #1044 fbdb13f #1068 719b1be #1079
  • Add BroadcastTenancyBootstrapper (makes multi-tenant broadcasting/websockets possible using tenant-specific keys) d7a4982 #1027
  • Add BroadcastChannelPrefixBootstrapper (makes multi-tenant broadcasting/websockets by prefixing channel names) c34952f ca400b5 00a00a2
  • Add cache prefix mode for separating tenant caches (introduces tenancy support for any cache driver, no longer only Redis) bd9bbe8 #1014
  • Support defining domains for tenants using a domain string column instead of a HasMany relation e25e7b7 8b0bdd4
  • Add InitializeTenancyByOriginHeader 9e4f33e
  • Add permission-controlled MSSQL database manager cf3d06c
  • Add the option to set headers and middleware in TenantAssetController a39da04 cc2d555 fdd401f
  • Add more tenant key generators dc43066 55b1c53
  • Make tenant column used by path identification parameters configurable, general resolver refactor 0c11f29
  • Add tenant:tinker command 6f4b9da 489fbb9
  • Add Tenancy::$findWith ac5948d

Changes

  • Respect user-defined $onFail in the Universal Routes feature 233a122 #679
  • Change how tenants:run is used with arguments a45aa8e #912 #686
  • Stronger typing, minor changes to the Tenant interface 55d0a9a 8af354c 87212e5 d463e2d a94227a f98a901 942d79c
  • Improved namespacing, all database-related logic was moved to namespaces under Stancl\Tenancy\Database 40bf28c
  • Refactor TenantDatabaseManagers d2e1ce0
  • Fix/improve Ignition solutions 55d0a9a 3542b3f
  • Reverse order of tenancy bootstrappers when reverting to central context 62d19c5 #932
  • Make impersonation tokens require stateful guards 3bf2c39 #935
  • Remove configurable static property from BelongsToTenant trait (deprecated in PHP 8.1), replace it with a config key 24146b2 e5bc8dd
  • Refactor more static properties to config keys ccaba05
  • Improve CLI command outputs using Laravel 9+ components e4f5b92 #968 5d688e6 68de360 #1030
  • Change TenantDatabaseManager-related interfaces, add public database(): Connection method fe0a322
  • Make tenants:migrate default to configured schema path a1a976c #985
  • Use a dedicated DB connection for creating/deleting tenant databases bf504f4 #946 (fixes bug #515)
  • Improve resource syncing logic 77c5ae1 #915 (fixes bug #658) 22d1b20 #993 ea3e445 #992, 758fbc8 #997 (adds polymorphic table for mapping resources to tenants) 6784685
  • Centralize config used by BelongsToTenant and HasDomains, replace all tenant_id literals dd0f03f 2a39b05 (fix #998), 82fa6cb
  • Convert publishable migrations to anonymous classes fb2369d #1001
  • Early identification (old version: ff46bcf, new version: 1d0ca27), related: 4953c69 e4df597 df9324b c312156 80b1183
  • Manual mode improvements (use correct event type, add new listeners) 73c5655 #1013
  • Add remember bool column to ImpersonationToken 228c267 #1101
  • Minor migrate:rollback fixes b503dbf
  • Fix PathTenantResolver when resolving tenant from cache 8db27a3, related aa1437f
  • Require MySQL 8 fd6070f
  • Disable asset_helper_tenancy by default, make the controller more configurable a39da04
  • Simplify Tenant contract, move run() logic to Tenancy, add generics af3b693
  • Simplify TenantWithDatabase contract, move tenantConfig() logic e8c3c75 29d1469
  • Drop Laravel 10 support ce8e74e
  • Add $ignoreExisting static property to CreateDatabase bf1ba69
  • Filesystem logic refactor a41ad69
  • Cache prefixing logic rewrite, session scoping improvements eecf6f2

Package changes

Footnotes

  1. Feature name subject to change