Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Archtechx/tenancy


Archtechx/tenancy


The `archtechx/tenancy` package is a flexible and powerful tool for implementing multi-tenancy in Laravel applications. Here are some key features and differences compared to other packages like `spatie/laravel-multitenancy`:

Key Features of `archtechx/tenancy`:

1. Automatic Multi-Tenancy: The package automatically sets up multi-tenancy without requiring significant code changes. It handles database connections, caches, filesystems, queues, and Redis stores for each tenant[3].

2. Event-Based Architecture: The package uses an event-driven architecture, allowing for customization and flexibility in handling tenancy-related events[3].

3. Single or Multi-Database Tenancy: It supports both single-database and multi-database tenancy models. For multi-database tenancy, it provides model traits for scoping models to the current tenant[3].

4. Integration with Other Packages: The package integrates seamlessly with other Laravel packages, including Laravel Nova, which can be used to manage tenant resources[3].

5. Testability: The package is designed to be highly testable, making it easier to ensure that your multi-tenancy implementation is thoroughly tested[3].

6. Customization: The package offers extensive customization options through its event-based architecture and model traits, allowing developers to tailor it to their specific needs[3].

Installation and Quickstart:

1. Installation: The package can be installed using Composer: `composer require stancl/tenancy`.

2. Quickstart: The package includes a quickstart tutorial that guides you through setting up multi-database tenancy and domain identification. This tutorial is available on the package's documentation page[4].

Comparison with `spatie/laravel-multitenancy`:

- Automatic Setup: Both packages offer automatic setup options, but `archtechx/tenancy` is more comprehensive in its automatic setup, handling more aspects of multi-tenancy out of the box.
- Event-Based Architecture: `archtechx/tenancy` uses an event-driven architecture, which provides more flexibility and customization options compared to `spatie/laravel-multitenancy`.
- Integration with Other Packages: Both packages integrate well with other Laravel packages, but `archtechx/tenancy` is more explicit in its support for packages like Laravel Nova.
- Testability: Both packages are designed to be testable, but `archtechx/tenancy` is more focused on testability and provides more tools to ensure thorough testing.

In summary, `archtechx/tenancy` offers a more comprehensive and flexible solution for multi-tenancy in Laravel, with extensive customization options and better integration with other packages. However, the choice between the two packages ultimately depends on the specific requirements and needs of your project.

Citations:
[1] https://stackoverflow.com/questions/74005556/archtechx-tenancy-vs-spatie-laravel-multitenancy
[2] https://github.com/archtechx/tenancy/actions
[3] https://tenancyforlaravel.com
[4] https://tenancyforlaravel.com/docs/v3/quickstart/
[5] https://github.com/stancl/tenancy/releases