Laravel Multidomain is a package by @gecche that allows a single Laravel Installation to work with multiple HTTP domains:
There are many cases in which different customers use the same application in terms of code but not in terms of database, storage, and configuration.
This package gives a very simple way to get a specific env file, a specific storage path, and a specific database for each such customer.
Once you finish the installation and setup outlined in the readme, you can use package commands to manage domains:
# Adding a domain php artisan domain:add site1.com php artisan domain:add site2.com # Removing a domain php artisan domain:remove site2.com
When you add a domain, the
.env configuration file is created for that specific domain:
php artisan domain:add site1.com # Generates the following configuration file .env.site1.com
You can also list domains with the
php artisan domain:list
Be sure to check out the full documentation of the package before deciding to use this package. This package provides an extended kernel and requires some buy-in in the methodology of this approach. Just make sure you evaluate the design of this package (and any package for that matter) for your use-case.
You can learn more about this package, get full installation instructions, and view the source code on GitHub at gecche/laravel-multidomain.Filed in: News
- Senior Laravel Developer (Remote)
Remote (US or Canada)
- Medior Laravel Backend Developer (The Netherlands/Dutch only)
Nijmegen, The Netherlands
- Laravel Developer
- Senior Laravel Backend Engineer
Remote, USA Only
- Senior Laravel Developer (b2b saas)
Join 31,000+ others and never miss out on new tips, tutorials, and more.