定制 jord-jd/laravel-domain-to-locale 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jord-jd/laravel-domain-to-locale

最新稳定版本:v3.0.0

Composer 安装命令:

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

包简介

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

README 文档

README

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

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

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,

After installation, the config file must be setup within your project. To do so, simply run the following Artisan command.

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

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.

<?php

return [

    // Define the mapping from domain name to locale

    'map' => [

        'example.com'   => 'en',
        'example.co.uk' => 'en',
        'example.pl'    => 'pl',
        'example.de'    => 'de',
        'example.fr'    => 'fr',

    ]

];

Adding new lines to the map array will allow you to specify which domain names should set which locales. Once configured, everything else is automatic.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2026-02-14