(WARNING: This work still in beta stage, so no warranty to use it in production)
In summary: "Plug & Play".
Who doesn't like it when "it just works" with no more steps to do and no more annoying configuration changes?
That's the aim of this package: Just "require & setup". With no more steps, no additional configuration, and no mandatory code changing, you get your app multi-tenancy ready, and everything is handled for you to run multiple web apps with one single Laravel installation.
- Easy install
- Console commands and Web interface
- Multiple databases
- Support: MySQL and SQLite
- Subdomain tenants
- Manage tenants (name, description, image): Create/Edit/Delete + Enable/Disable
- Backup & restore tenants' DBs & files
You can install this package via Composer by running this command in your terminal in the root of your project:
composer require fbnkcmaster/xtenant
To get started, I have prepared a demo app to test this package with it.
Go ahead and install the demo-app you can find here and come back to continue:
https://github.com/FBNKCMaster/demo-app
If everything is ok, switch to the repo folder where you have installed demo-app
cd demo-app
Install xTenant package using composer
composer require fbnkcmaster/xtenant
Here are the steps and commands you will need to use this package:
1/ First, setup the package
php artisan xtenant:setup
You will be asked to enter:
- The [superadmin] subdomain to be able to access SuperAdmin's web interface
- The email address and password of the SuperAdmin
- And finally, if you want to allow "www" for subdomains.
2/ Create your first tenant
You have two options:
php artisan xtenant:new
You will have to choose a subdomain, a name, and a description for this tenant.
If the subdomain already exists, you will be asked to edit or override it.
Then you will be asked if you want to run migrations, seeds and create a directory for this tenant.
To create a new tenant or manage existing ones, you will need to access the SuperAdmin web interface:
http://[superadmin].demo-app.test/login
Enter your credentials (SuperAdmin's email address and password) to connect.
Then go ahead and click on the "Create New Tenant" red button to create your first tenant.
3/ That's all. If everything is ok you will be able to access your tenant at:
http://[tenant_subdomain].demo-app.test
- PostgreSQL and SQLServer support
- Handling Queues
- Web Console
- Manage Databases (Backups & Restorations)
- Is it free?
Yes!
- Can I contribute?
Yes!
- How to support?
Anything you can do to help is appreciated :)
Feedbacks are welcome!
Feel free to open issues or direct contact me via twitter (@FBNKCMaster)
xTenant is an open source project and anyone can contribute to make it better.
So if you like the philosophy and the idea, feel free to fork, test, PR, rise issues, suggest ideas and sponsor as well :)
Big thanks to the great community of [ Laravel + Vue.js/Alpine.js + Tailwind CSS ] especially:
- Taylor Otwell and the team: for Laravel, the great framework
- Tom Schlick: being the first to talk and bringing first insights and ideas about multi-tenancy with Laravel
- Mohamed Said: for his tutorials on youtube and write-ups about this complex subject
- Adam Wathan and the team: for the awesome Tailwind CSS
- Caleb Porzio: for Alpine.js (really sweet alternative to Vue.js)