PHPackages                             divineomega/laravel-domain-to-locale - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. divineomega/laravel-domain-to-locale

Abandoned → [jord-jd/laravel-domain-to-locale](/?search=jord-jd%2Flaravel-domain-to-locale)Library[Localization &amp; i18n](/categories/localization)

divineomega/laravel-domain-to-locale
====================================

Change your Laravel app's locale based on the domain name

v3.1.0(4w ago)32461LGPL-3.0-onlyPHPPHP &gt;=7.1CI passing

Since May 22Pushed 4w agoCompare

[ Source](https://github.com/Jord-JD/laravel-domain-to-locale)[ Packagist](https://packagist.org/packages/divineomega/laravel-domain-to-locale)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/divineomega-laravel-domain-to-locale/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (4)Dependencies (4)Versions (5)Used By (0)

Laravel Domain To Locale
========================

[](#laravel-domain-to-locale)

Change your Laravel app's locale based on the domain name.

Supports Laravel 5.6 through 13. The package configuration is loaded automatically; publishing it is only required when you want to customise mappings.

Installation
------------

[](#installation)

To install the Laravel Domain To Locale package, just run the following Composer command from the root of your project.

```
composer require jord-jd/laravel-domain-to-locale
```

Setup
-----

[](#setup)

This package requires you to register a global middleware within your `app\Http\Kernel.php` file. Just add the line below to your `$middleware` array.

```
\JordJD\LaravelDomainToLocale\Http\Middleware\DomainToLocale::class,
```

To customise the mappings, publish the config file with:

```
php artisan vendor:publish --provider="JordJD\LaravelDomainToLocale\ServiceProvider"
```

Configuration
-------------

[](#configuration)

The published configuration file for this package can be found at `config/domain-to-locale.php`. This file defines a map between domain name and locale, as shown in the example below.

```
