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
Join the weekly newsletter and never miss out on new tips, tutorials, and more.
- PHP Data Engineer
- Software Developer
Remote (US & Canada)
- Backend Software Engineer
Remote (UTC +/- 5)
Remote (Overlap w/ Continental US Time Zones)
- Senior Backend Engineer
- Senior Laravel Developer
- Full-Stack Developer (JS - Vue.js, PHP - Laravel)
US Remote / Telecommute