PHPackages                             maxsky/umeng-service - 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. maxsky/umeng-service

ActiveLibrary

maxsky/umeng-service
====================

UMeng Service

v1.0(4y ago)06MITPHPPHP ^7.2.5|^8.0

Since May 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/maxsky/umeng-service)[ Packagist](https://packagist.org/packages/maxsky/umeng-service)[ RSS](/packages/maxsky-umeng-service/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

UMeng Service 友盟服务
==================

[](#umeng-service-友盟服务)

[![996.icu](https://camo.githubusercontent.com/ac8f294a80f65338db545230f1a881b9a382204a1f187c6ff40ee679d42d40ca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c696e6b2d3939362e6963752d7265642e737667)](https://996.icu)

支持服务
----

[](#支持服务)

- 一键登录
- 推送

安装
--

[](#安装)

```
composer require maxsky/umeng-service
```

调用
--

[](#调用)

### 一键登录

[](#一键登录)

**证书文件（.pem）命名格式为：android\_pri\_key.pem 和 ios\_pri\_key.pem，需放置到同一目录**

```
// 示例 Laravel/Lumen 框架获取 POST 请求中 platform 参数
$platform = $request->post('platform', 'Android'); // 请求中获取所属平台 Android/iOS

// 一键登录 Token，由 App 方传入
$token = $request->post('token');

// 转成大写
$platform = strtoupper($platform);

// 获取平台 App Key，Laravel/Lumen 中设置环境配置 UMENG_IOS_APP_KEY=123456 和 UMENG_ANDROID_APP_KEY=654321。供参考
$platformKey = env("UMENG_{$platform}_APP_KEY");

try {
    // 成功时返回手机号码
    $mobileNumber = OneKeyLogin::getInstance(
        // 获取一键登录所需 App Key 及 App Secret
        env('UMENG_ONE_KEY_LOGIN_APP_KEY'), env('UMENG_ONE_KEY_LOGIN_APP_SECRET'))
        ->setPlatformKey($platformKey)
        // 设置证书文件所在位置，需注意命名。此处在 Laravel/Lumen 框架中为：项目目录/storage/app/oklogin
        ->setKeyPath(storage_path('app/oklogin'))
        ->oneKeyLogin($platform, $token);
} catch (UMengServiceException $e) {
    Log::error('一键登录异常，错误消息：' . $e->getMessage());

    throw new Exception('获取手机号码失败');
}
```

### 推送

[](#推送)

推送参数可参考文档：[友盟 - 消息推送 - API 集成文档](https://developer.umeng.com/docs/67966/detail/68343)

```
try {
    $broadcast = new AndroidBroadcast();

    $broadcast->setAppMasterSecret('MasterSecret');
    $broadcast->setPredefinedKeyValue('appkey', 'AppKey');
    $broadcast->setPredefinedKeyValue('timestamp', time());
    $broadcast->setPredefinedKeyValue('ticker', 'Android broadcast ticker');
    $broadcast->setPredefinedKeyValue('title', '中文的 title');
    $broadcast->setPredefinedKeyValue('text', 'Android broadcast text');
    $broadcast->setPredefinedKeyValue('after_open', 'go_app');

    // Set 'production_mode' to 'false' if it's a test device.
    // For how to register a test device, please see the developer doc.
    $broadcast->setPredefinedKeyValue('production_mode', 'true');

    // [optional] Set extra fields
    $broadcast->setExtraField('test', 'helloworld');

    $result = $broadcast->send();

    if ($result['ret'] === 'SUCCESS') {
        // 成功
    }
} catch (UMengServiceException $e) {
    Log::error('推送异常，错误消息：' . $e->getMessage());

    throw new Exception('推送失败');
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1462d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f8f4aa99ca479f6fb6b162b4b56ce4e8e8e96518c828949a69b2db37ae4ecb0?d=identicon)[maxsky](/maintainers/maxsky)

---

Top Contributors

[![maxsky](https://avatars.githubusercontent.com/u/7405522?v=4)](https://github.com/maxsky "maxsky (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/maxsky-umeng-service/health.svg)

```
[![Health](https://phpackages.com/badges/maxsky-umeng-service/health.svg)](https://phpackages.com/packages/maxsky-umeng-service)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[magento/community-edition

Magento 2 (Open Source)

12.1k52.1k10](/packages/magento-community-edition)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[packbackbooks/lti-1p3-tool

A library used for building IMS-certified LTI 1.3 tool providers in PHP.

51438.3k2](/packages/packbackbooks-lti-1p3-tool)

PHPackages © 2026

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