v4 Changelog & Upgrade Guide

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)
  • 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
  • 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
  • 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
  • Add maintenance mode events 3f60c4a #979
  • Add cookie option on InitializeTenancyByRequestData 05f1b2d #980
  • Add pending tenants1 198f34f #869 7d3298c #1025
  • Add SessionTenancyBootstrapper (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
  • Add skip-failing option to tenants:migrate command 342c67f #945
  • Allow defining the tenant connection template using array syntax 087733d #1040
  • Add UrlTenancyBootstrapper (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) d7a4982 #1027
  • Add cache prefix mode for separating tenant caches (introduces tenancy support for any cache driver, no longer only Redis) bd9bbe8 #1014

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)
  • 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
  • Only delete tenants in MigrateFreshOverride if the tenants table exists 9520cbc #1007
  • Early identification (old version: ff46bcf, new version: 1d0ca27)
  • Manual mode improvements (use correct event type, add new listeners) 73c5655 #1013
  • Add remember bool column to ImpersonationToken 228c267 #1101

Package changes

1

Feature name subject to change