ramaid/multi-tenant
Composer 安装命令:
composer require ramaid/multi-tenant
包简介
Run multiple websites using the same laravel installation while keeping tenant specific data separated for fully independant multi-domain setups.
README 文档
README
The unobtrusive Laravel package that makes your app multi tenant. Serving multiple websites, each with one or more hostnames from the same codebase. But with clear separation of assets, database and the ability to override logic per tenant.
Suitable for marketing companies that like to re-use functionality for different clients or start-ups building the next software as a service.
Offers:
- Integration with the awesome Laravel framework.
- Event driven, extensible architecture.
- Close - optional - integration into the web server.
- The ability to add tenant specific configs, code, routes etc.
Database separation methods:
- One system database and separated tenant databases (default).
- Table prefixed in the system database.
- Or .. manually, the way you want, by listening to an event.
Complete documentation covers more than just the installation and configuration.
Requirements, recommended environment
- Laravel 9.0+.
- PHP 8.0+
- Apache or Nginx.
- MySQL, MariaDB, or PostgreSQL.
Please read the full requirements in the documentation.
Installation
composer require hyn/multi-tenant
Automatic service registration
Using auto discovery, the tenancy package will be auto detected by Laravel automatically.
Manual service registration
In case you want to disable webserver integration or prefer manual integration,
set the dont-discover in your application composer.json, like so:
{
"extra": {
"laravel": {
"dont-discover": [
"hyn/multi-tenant"
]
}
}
}
If you disable auto discovery you are able to configure the providers by yourself.
Register the service provider in your config/app.php:
'providers' => [ // [..] // Hyn multi tenancy. Hyn\Tenancy\Providers\TenancyProvider::class, // Hyn multi tenancy webserver integration. Hyn\Tenancy\Providers\WebserverProvider::class, ],
Deploy configuration
First publish the configuration and migration files so you can modify it to your needs:
php artisan vendor:publish --tag tenancy
Open the config/tenancy.php and config/webserver.php file and modify to your needs.
Make sure your system connection has been configured in
database.php. In case you didn't override the system connection name thedefaultconnection is used.
Now run:
php artisan migrate --database=system
This will run the required system database migrations.
Backers
Thank you to all our backers! 🙏 [Become a backer]
Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]
Contributors
License and contributing
This package is offered under the MIT license. In case you're interested at contributing, make sure to read the contributing guidelines.
Testing
Run tests using:
vendor/bin/phpunit
If using MySQL, use:
LIMIT_UUID_LENGTH_32=1 vendor/bin/phpunit
Please be warned running tests will reset your current application completely, dropping tenant and system databases and removing the tenancy.json file inside the Laravel directory.
Changes
All changes are covered in the changelog.
Contact
Get in touch personally using;
- The email address provided in the composer.json.
- Discord chat.
- Twitter.
ramaid/multi-tenant 适用场景与选型建议
ramaid/multi-tenant 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 301 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「saas」 「multi-tenant」 「tenancy」 「multi-tenancy」 「hyn」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ramaid/multi-tenant 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ramaid/multi-tenant 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ramaid/multi-tenant 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel Plans is a package for SaaS apps that need management over plans, features, subscriptions, events for plans or limited, countable features.
Asaas.com PHP API v3 Wrapper
Adaptaçao Asaas.com PHP API Wrapper para PHP 5.6
Laravel Tenant Multi-Self-Hosted-DB connections with Migration tools package for Laravel 5.1+
Alfabank REST API integration
This bundle provides tools to build multi-tenant architecture for PHP applications.
统计信息
- 总下载量: 301
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-04