承接 richan-fongdasen/laravel-i18n 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

richan-fongdasen/laravel-i18n

最新稳定版本:3.4.0

Composer 安装命令:

composer require richan-fongdasen/laravel-i18n

包简介

Simple route and eloquent localization / translation in Laravel

README 文档

README

Build codecov StyleCI Analysis Status Total Downloads Latest Stable Version License: MIT

Laravel I18n

Simple Route localization and Eloquent translation in Laravel

Synopsis

This package provides easy ways to setup database translation and route localization.

Table of contents

Setup

Install the package via Composer :

$ composer require richan-fongdasen/laravel-i18n

Publish package assets

Publish the package asset files using this php artisan command

$ php artisan vendor:publish --provider="RichanFongdasen\I18n\ServiceProvider"

The command above would create three new files in your application, such as:

  • New configuration file /config/i18n.php
  • New database migration /database/migrations/0000_00_00_000000_create_languages_table.php
  • New languages json file /storage/i18n/languages.json

Configuration

return [

    /*
    |--------------------------------------------------------------------------
    | Language repository driver
    |--------------------------------------------------------------------------
    |
    | Define your language repository driver here. The available options are:
    | database and json.
    |
    */

    'driver' => 'json',

    /*
    |--------------------------------------------------------------------------
    | Language repository datasource
    |--------------------------------------------------------------------------
    |
    | Define your language repository datasource here.
    |   - Define your database table name, when you're using database driver.
    |   - Define your json file path, when you're using json driver.
    |
    */

    'language_datasource' => storage_path('i18n/languages.json'),
//    'language_datasource' => 'languages',

    /*
    |--------------------------------------------------------------------------
    | Cache duration
    |--------------------------------------------------------------------------
    |
    | Define how long we should cache the language dataset in seconds.
    |
    */

    'cache_duration' => 60 * 60 * 24,

    /*
    |--------------------------------------------------------------------------
    | Language key
    |--------------------------------------------------------------------------
    |
    | Define which language key in datasource that we should use.
    | Available options are:
    |   - language, ie: en, es, de, etc.
    |   - ietfCode, ie: en-US, en-UK, de-DE, etc.
    |
    */

    'language_key' => 'language',

    /*
    |--------------------------------------------------------------------------
    | API query key
    |--------------------------------------------------------------------------
    |
    | Define the query parameter name which will be used as language selector
    | in every API request.
    | e.g: http://localhost:8000/api/articles?lang=en
    |
    */

    'api_query_key' => 'lang',

    /*
    |--------------------------------------------------------------------------
    | Language negotiator class
    |--------------------------------------------------------------------------
    |
    | Define your language negotiator class here.
    | The class should implement LanguageNegotiator contract / interface.
    |
    */

    'negotiator' => \RichanFongdasen\I18n\Negotiators\BrowserNegotiator::class,

    /*
    |--------------------------------------------------------------------------
    | Locale URL segment number
    |--------------------------------------------------------------------------
    |
    | Define which url segment number that will be used to put the current
    | locale information. URL segment is started with '1'.
    | e.g: http://my-application.app/en/home
    |
    */

    'locale_url_segment' => 1,

    /*
    |--------------------------------------------------------------------------
    | Translation table suffix
    |--------------------------------------------------------------------------
    |
    | Define your preferred suffix to be appended to your database's
    | translation table name.
    |
    */

    'translation_table_suffix' => 'translations',

    /*
    |--------------------------------------------------------------------------
    | Enable Store to the cache
    |--------------------------------------------------------------------------
    |
    | Toggle store locale to the cache
    |
    */

    'enable_cache' => env('I18N_ENABLE_CACHE', true),

];

Documentation

Please check the documentation here https://laravel-i18n.richan.id/

Credits

  • mcamara/laravel-localization - Route localization concepts in this repository was inspired by this package.
  • Wico Chandra - Database translation concepts in this repository was inspired by his Model Translation concept.
  • dimsav/laravel-translatable - Some of database translation concepts in this repository was inspired by this package.

License

The MIT License (MIT). Please see License File for more information.

richan-fongdasen/laravel-i18n 适用场景与选型建议

richan-fongdasen/laravel-i18n 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 92.77k 次下载、GitHub Stars 达 13, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「i18n」 「translation」 「routes」 「intl」 「laravel」 「localization」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 richan-fongdasen/laravel-i18n 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 richan-fongdasen/laravel-i18n 我们能提供哪些服务?
定制开发 / 二次开发

基于 richan-fongdasen/laravel-i18n 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 92.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 39
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04