PHPackages                             byteflick/laravel-domain-localization - 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. byteflick/laravel-domain-localization

ActiveLibrary[Localization &amp; i18n](/categories/localization)

byteflick/laravel-domain-localization
=====================================

A Laravel package facilitating efficient locale determination based on domain names, simplifying multi-language website development.

v1.0.2(2y ago)79[5 PRs](https://github.com/ByteFlick/laravel-domain-localization/pulls)MITPHPPHP ^8.1CI passing

Since Mar 17Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/ByteFlick/laravel-domain-localization)[ Packagist](https://packagist.org/packages/byteflick/laravel-domain-localization)[ Docs](https://github.com/byteflick/laravel-domain-localization)[ GitHub Sponsors](https://github.com/ByteFlick)[ RSS](/packages/byteflick-laravel-domain-localization/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (9)Versions (10)Used By (0)

[![](https://github.com/ByteFlick/.github/raw/main/profile/btye-flick-logo.png?raw=true)](https://github.com/ByteFlick/.github/blob/main/profile/btye-flick-logo.png?raw=true)

Domain-Based Localization for Laravel
=====================================

[](#domain-based-localization-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/892e5b6b7ea82937033290a559a1096c165d928c9a3d18d90d0c72ca24e0fe04/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62797465666c69636b2f6c61726176656c2d646f6d61696e2d6c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/byteflick/laravel-domain-localization)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c7b5b211b7121015d8e59fc463b0f5c2aecda2ce3bbc4eba38c8745bdcaeb75a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62797465666c69636b2f6c61726176656c2d646f6d61696e2d6c6f63616c697a6174696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/byteflick/laravel-domain-localization/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/5b1bd00eab28cf52be4fbf652d9cc4e6faeeea1b83e1c6216f030bc7c2894a19/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f62797465666c69636b2f6c61726176656c2d646f6d61696e2d6c6f63616c697a6174696f6e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/byteflick/laravel-domain-localization/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f1bf2718e275f9ba23e11f2eb321d238dab1650d80b0f29225cc244d93a46b68/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62797465666c69636b2f6c61726176656c2d646f6d61696e2d6c6f63616c697a6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/byteflick/laravel-domain-localization)

Introducing "Domain-Based Localization for Laravel" – a powerful Laravel package designed to streamline the localization process for multi-language web applications. With seamless integration, this package empowers developers to effortlessly assign locales based on domain names, simplifying the management of language variations across diverse web environments. Experience streamlined localization management and enhanced user experiences with Domain-Based Localization for Laravel.

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

[](#installation)

You can install the package via composer:

```
composer require byteflick/laravel-domain-localization
```

You can publish the config file with:

```
php artisan vendor:publish --provider="ByteFlick\LaravelDomainLocalization\LaravelDomainLocalizationServiceProvider"
```

This is the contents of the published config file:

Note: If you set the mode to `strict` then if the middleware cannot find a locale it aborts the request.

```
return [
    'mode' => 'loose', // strict or loose
    'locales' => [
        'en' => ['name' => 'English', 'domain' => 'localhost.com'],
        // 'es' => ['name' => 'Spanish', 'domain' => 'localhost.com.tr'],
        // 'tr' => ['name' => 'Turkish', 'domain' => 'localhost.com.es'],
        // ... More locales can be added here.
    ]
];
```

Usage
-----

[](#usage)

### Step 1: Publish the Config File

[](#step-1-publish-the-config-file)

Publish the config file via the command below and configure it according to your needs.

```
php artisan vendor:publish --provider="ByteFlick\LaravelDomainLocalization\LaravelDomainLocalizationServiceProvider"
```

### Step 2: Apply the Middleware

[](#step-2-apply-the-middleware)

#### On Specific Routes Only

[](#on-specific-routes-only)

You can add the middleware to individual routes or apply it via a route group.

#### Globally For Laravel 11

[](#globally-for-laravel-11)

Append the middleware to your default middlewares into your `bootstrap/app.php` via the code below.

```
->withMiddleware(function (Middleware $middleware) {
     $middleware->append(\ByteFlick\LaravelDomainLocalization\Middlewares\HandleLocalizationViaDomain::class);
})
```

#### Globally For Laravel 10

[](#globally-for-laravel-10)

Add the middleware to your default middlewares into your `App\Http\Kernel.php` via the code below.

```
protected $middleware = [
    \ByteFlick\LaravelDomainLocalization\Middlewares\HandleLocalizationViaDomain::class,
];
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [ByteFlick](https://github.com/ByteFlick)
- [ORPtech](https://orptech.com)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance57

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

839d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1fe3891cb9de906466f4c197aca348156f27932890543c96a994becf2755bf1?d=identicon)[ArdaKaraderi](/maintainers/ArdaKaraderi)

---

Top Contributors

[![ArdaKaraderi](https://avatars.githubusercontent.com/u/22325146?v=4)](https://github.com/ArdaKaraderi "ArdaKaraderi (16 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (8 commits)")

---

Tags

domainlaravellocalisationlocalizationmiddlewarephplaravellaravel-domain-localizationByteFlick

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/byteflick-laravel-domain-localization/health.svg)

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

###  Alternatives

[spatie/laravel-permission

Permission handling for Laravel 12 and up

12.9k102.4M1.4k](/packages/spatie-laravel-permission)[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[spatie/laravel-passkeys

Use passkeys in your Laravel app

471890.7k39](/packages/spatie-laravel-passkeys)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[elegantly/laravel-translator

All on one translations management for Laravel

6333.1k](/packages/elegantly-laravel-translator)

PHPackages © 2026

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