Laravel Multidomain Package
Published on by Paul Redmond
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 domainphp artisan domain:add site1.comphp artisan domain:add site2.com# Removing a domainphp 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.