komicho / laravel-switch-domain
Switch between all domains of your project on development mode
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
pkg:composer/komicho/laravel-switch-domain
This package is not auto-updated.
Last update: 2025-10-05 21:31:08 UTC
README
Switch between all domains of your project on development mode
Install via composer
$ composer require komicho/laravel-switch-domain dev-master
set_domain
method
set_domain('<domain.dev>');
add KOMICHO_SWITCH_DOMAIN_TO
to .env file
KOMICHO_SWITCH_DOMAIN_TO=<domain.dev>
If the value is empty, the domains will work in their default form
How to use
use set_domain
method on domain
method .. such as the following example
... ->domain(set_domain('<domain.dev>')) ...
Full example
Go to file app/Providers/RouteServiceProvider.php
.
web routes
protected function mapWebRoutes() { Route::middleware('web') ->namespace($this->namespace) ->domain(set_domain('domain.dev')) ->group(base_path('routes/web.php')); }
app routes
protected function mapAppRoutes() { Route::middleware('web') ->namespace($this->namespace) ->domain(set_domain('app.domain.dev'))) ->group(base_path('routes/app.php')); }
According to rules MPL :)
THX.