PHPackages                             komicho/laravel-switch-domain - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. komicho/laravel-switch-domain

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

komicho/laravel-switch-domain
=============================

Switch between all domains of your project on development mode

0211PHP

Since Mar 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/komichoss/laravel-switch-domain)[ Packagist](https://packagist.org/packages/komicho/laravel-switch-domain)[ RSS](/packages/komicho-laravel-switch-domain/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

komicho\\laravel-switch-domain
==============================

[](#komicholaravel-switch-domain)

Switch between all domains of your project on development mode

Install via composer
--------------------

[](#install-via-composer)

```
$ composer require komicho/laravel-switch-domain dev-master
```

---

`set_domain` method
-------------------

[](#set_domain-method)

```
set_domain('');
```

add `KOMICHO_SWITCH_DOMAIN_TO` to .env file
-------------------------------------------

[](#add-komicho_switch_domain_to-to-env-file)

```
KOMICHO_SWITCH_DOMAIN_TO=
```

> If the value is empty, the domains will work in their default form

How to use
----------

[](#how-to-use)

use `set_domain` method on `domain` method .. such as the following example

```
...
->domain(set_domain(''))
...
```

Full example
------------

[](#full-example)

Go to file `app/Providers/RouteServiceProvider.php`.

### web routes

[](#web-routes)

```
protected function mapWebRoutes()
{
    Route::middleware('web')
            ->namespace($this->namespace)
            ->domain(set_domain('domain.dev'))
            ->group(base_path('routes/web.php'));
}
```

### app routes

[](#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](https://medium.com/@komicho/micro-package-logic-mpl-10f22ccc50c1) :)

THX.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31162701?v=4)[komicho](/maintainers/komicho)[@komicho](https://github.com/komicho)

---

Top Contributors

[![komtcho](https://avatars.githubusercontent.com/u/12757671?v=4)](https://github.com/komtcho "komtcho (3 commits)")

---

Tags

domainskomicholaravelmplpackagesphpswitch

### Embed Badge

![Health badge](/badges/komicho-laravel-switch-domain/health.svg)

```
[![Health](https://phpackages.com/badges/komicho-laravel-switch-domain/health.svg)](https://phpackages.com/packages/komicho-laravel-switch-domain)
```

###  Alternatives

[tatter/themes

Lightweight theme manager for CodeIgniter 4

1710.2k2](/packages/tatter-themes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
