PHPackages                             topkee/topkee-lang-service-phpsdk - 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. topkee/topkee-lang-service-phpsdk

ActiveLibrary

topkee/topkee-lang-service-phpsdk
=================================

topkee多语言sdk php版本

0858↓100%PHP

Since Aug 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/TopkeeMedia/topkee-lang-service-phpsdk)[ Packagist](https://packagist.org/packages/topkee/topkee-lang-service-phpsdk)[ RSS](/packages/topkee-topkee-lang-service-phpsdk/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

在多语言管理后添加项目
-----------

[](#在多语言管理后添加项目)

记住项目的appid和appsecret， 假设你的项目 appid='111111' appsecret='222222'

安装php版sdk
---------

[](#安装php版sdk)

```
composer require topkee/topkee-lang-service-phpsdk
```

基本使用
----

[](#基本使用)

```
        // 假设这是本地配置
        $localMessages=[
            "en"=>[
                "test.test2"=>"test",
                "care"=>[
                    "add"=>"test add2"
                ]

             ]
        ];
        $appid='111111';
        $appsecret='222222';
       // 1创建sdk实例
        $sdk=LangSdk::getInstance($appid,$appsecret);
//        $sdk->onLocaleMessage(function ($lang,$message) {
//            echo "语言 $lang 配置： ".json_encode($message,JSON_PRETTY_PRINT).PHP_EOL;
//
//        });
        // 2 加载本地配置到sdk
        $sdk->loadLocalesMessages($localMessages);
        // 3 获取合并后的多语言配置
        $messages=$sdk->getMessages();
//        echo json_encode($messages);
//        {
//            "zh_CN": {
//                "care.add": "添 加",
//                "care.addCare": "添加客服",
//                "care.addGroup": "新建分组"
//
//            },
//            "en": {
//                "test.test2"=>"test",
//                "care.add": "Add",
//                "care.addCare": "Add Care",
//                "care.addGroup": "New Group"
//            },
//            "zh_TW": {
//                "care.add": "添加",
//                "care.addCare": "添加客服",
//                "care.addGroup": "新建分組"
//            }
//        }

        // 4 安装i18n做翻译(不一定要使用这个库)
        // composer require exactcure/i18next-php -W
        $i18n = new I18n([
            'lng'           =>  'en',
            'resources'     =>  $messages
        ]);

        $i18n->t('care.add'); // "Add"

```

本地配置上传下载命令
----------

[](#本地配置上传下载命令)

```
php vendor/bin/topkeelang-upload.php appid=111111 APPSECRET=222222 path=./resources/lang
```

> path是你本地存放多语言配置的目录，比如laravel的多语言目录就是./resources/lang

其他语言sdk
-------

[](#其他语言sdk)

- [topkee-lang-service-phpsdk](https://github.com/TopkeeMedia/topkee-lang-service-phpsdk)
- [topkee-lang-service-jssdk](https://github.com/TopkeeMedia/topkee-lang-service-jssdk)

###  Health Score

17

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity20

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://www.gravatar.com/avatar/da92ec836309fdb0ff456c2e97d3e11887456a68b2ef9142ab26ef291e2ed197?d=identicon)[rayNip](/maintainers/rayNip)

---

Top Contributors

[![rayNip](https://avatars.githubusercontent.com/u/89056179?v=4)](https://github.com/rayNip "rayNip (29 commits)")

### Embed Badge

![Health badge](/badges/topkee-topkee-lang-service-phpsdk/health.svg)

```
[![Health](https://phpackages.com/badges/topkee-topkee-lang-service-phpsdk/health.svg)](https://phpackages.com/packages/topkee-topkee-lang-service-phpsdk)
```

PHPackages © 2026

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