我正在使用 Laravel 构建多个共享相似功能和数据库结构的后端系统。这些系统用于不同的目的或客户端,但它们具有重叠的功能,例如身份验证、共享数据库表和通用业务逻辑。现在,我正在两种方法之间进行辩论: 选项 1:一个大型整体 Laravel 应用程序
A single Laravel app where all functionality is implemented.
Use multi-tenancy to separate data for different clients or projects (e.g., per-tenant database or tenant_id in tables).
Centralized codebase makes it easier to manage shared logic and updates.
选项 2:多个独立的 Laravel 应用程序
Each project has its own Laravel app.
Shared migrations and logic can be placed in a shared package or directory (e.g., using a Composer package or loadMigrationsFrom for migrations).
Projects are fully isolated and can evolve independently, but updates to shared logic or schema need to be synced across all apps.
对于多个后端项目,您需要有多个 Laravel 应用程序。