PHPackages                             gaowei-space/meituan-pub-union - 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. [API Development](/categories/api)
4. /
5. gaowei-space/meituan-pub-union

ActiveLibrary[API Development](/categories/api)

gaowei-space/meituan-pub-union
==============================

美团分销联盟 PHP-SDK

v1.1.1(4y ago)24817MITPHPPHP &gt;=7.2.5

Since Nov 21Pushed 4y ago1 watchersCompare

[ Source](https://github.com/gaowei-space/meituan-pub-union)[ Packagist](https://packagist.org/packages/gaowei-space/meituan-pub-union)[ RSS](/packages/gaowei-space-meituan-pub-union/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (1)Versions (6)Used By (0)

🌈 Meituan-Pub-Union
===================

[](#-meituan-pub-union)

[![PHP Version](https://camo.githubusercontent.com/b0b44e3a17a8be43a91fde19e0bafdd9e553b8a16fe9b5b36f4284dfbe9d20cd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d2533453d372e322e352d3838393242462e737667)](https://www.php.net/)[![GitHub branch checks state](https://camo.githubusercontent.com/09f1ecede5dae44526a5e39503564bc97edf13af6021ec08b0645fa0b1e01e6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f636865636b732d7374617475732f67616f7765692d73706163652f6d65697475616e2d7075622d756e696f6e2f6d61696e)](https://github.com/gaowei-space/meituan-pub-union/tree/main)[![Packagist Version](https://camo.githubusercontent.com/bb6f5bd0430b02fe67b69e2eba1b72b2a1f3bbf5e58476a4fbefd8ece953e69f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67616f7765692d73706163652f6d65697475616e2d7075622d756e696f6e3f636f6c6f723d6f72616e6765)](https://packagist.org/packages/gaowei-space/meituan-pub-union)[![StyleCI build status](https://camo.githubusercontent.com/05126502fad0da3c7aaca4dfb7c481249146cb2d856e2636667b948167a6bc2d/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3433303338313636312f736869656c643f7374796c653d666c6174)](https://camo.githubusercontent.com/05126502fad0da3c7aaca4dfb7c481249146cb2d856e2636667b948167a6bc2d/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3433303338313636312f736869656c643f7374796c653d666c6174)[![Latest Release](https://camo.githubusercontent.com/d727f2b75e2cbc929cb4f5c3699f36aa349bf53a0fe061574e560b294bb0ea21/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f67616f7765692d73706163652f6d65697475616e2d7075622d756e696f6e)](https://github.com/gaowei-space/meituan-pub-union/releases)[![License](https://camo.githubusercontent.com/6cad70e148ee13da192fc737087ee689381565639a8d166d92888f8a4118a803/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f67616f7765692d73706163652f6d65697475616e2d7075622d756e696f6e)](https://github.com/gaowei-space/meituan-pub-union/LICENSE)

[Meituan-Pub-Union](https://github.com/gaowei-space/meituan-pub-union) 是美团分销联盟API的PHP-SDK

安装
--

[](#安装)

```
$ composer require gaowei-space/meituan-pub-union -vvv
```

配置
--

[](#配置)

在使用本扩展之前，你需要去 [美团分销联盟](https://pub.meituan.com) 注册账号，签约入驻后创建应用，获取应用的 app\_key 和 utm\_source。

支持
--

[](#支持)

- ✅ 获取全国省份 `ProvinceAllRequest`
- ✅ 获取某省份的城市 `CitiesRequest`
- ✅ 获取某个城市的一级类目包含的二级类目信息 `CategoriesRequest`
- ✅ 获取某个城市的商圈信息（点评）`RegionsByDianPingRequest`
- ✅ 获取某个城市的商圈信息（美团）`RegionsByMeiTuanRequest`
- ✅ 到店商品搜索 `SearchDealsRequest` (美团已停止该接口请求权限，[了解](https://github.com/gaowei-space/meituan-pub-union/issues/4))
- ✅ 分销取链 `LinksRequest`
- ✅ 异常订单数据 `OrdersAbnormalRequest`
- ✅ CPA订单数据 `OrdersCPARequest`
- ✅ CPS订单数据 `OrdersCPSRequest`
- ✅ 秒杀场次 `SeckillShowInfoRequest`
- ✅ 秒杀团单列表 `SeckillListRequest`
- 🆕 其他暂未支持，接下来会支持完善到店模块接口

使用
--

[](#使用)

### 获取某个省份的城市列表

[](#获取某个省份的城市列表)

```
use GaoweiSpace\MeituanPubUnion\Api\Common\Request\CitiesRequest;
use GaoweiSpace\MeituanPubUnion\Http\Client;

$app_key    = 'xxxxxxxxxx';
$utm_source = 'xxxxxxxxxx';

// 实例化获取城市的请求类
$request = new CitiesRequest();
// 设置省份ID
$request->setProvinceId(1);

// 实例客户端类
$client = new Client($app_key, $utm_source);

// 发送请求调用接口
$response = $client->syncInvoke($request);
```

### 请求参数

[](#请求参数)

> 请求参数的设置，请结合 [美团分销联盟API文档](https://pub.meituan.com/#/api-doc)，确认要使用的参数，调用对应请求API类的对应方法进行设置

每个请求API类中对于各个参数都已经内置了 `set` 前缀的设置方法，如：

```
public function setUtmSource(string $utmSource): void
{
    $this->utmSource = $utmSource;
}
```

调用对应方法，进行参数设置：

```
$request->setUtmSource('***');
```

### 在 Laravel 中使用

[](#在-laravel-中使用)

在 Laravel 中使用也是同样的安装方式，配置写在 `config/services.php` 中：

```
'meituan' => [
    'pub_union' => [
        'app_key'    => env('MEITUAN_PUB_UNION_APP_KEY'),
        'utm_source' => env('MEITUAN_PUB_UNION_UTM_SOURCE'),
    ]
]
```

然后在 .env 中配置：

```
MEITUAN_PUB_UNION_APP_KEY=xxxxxxxxxxxxxxxxxxxxx
MEITUAN_PUB_UNION_UTM_SOURCE=xxxxxxxxxxxxxxxxxxxxx

```

### 可以用两种方式来获取 `GaoweiSpace\MeituanPubUnion\Http\Client` 实例：

[](#可以用两种方式来获取-gaoweispacemeituanpubunionhttpclient-实例)

#### 方法参数注入

[](#方法参数注入)

```
use GaoweiSpace\MeituanPubUnion\Http\Client;

public function getCities(Client $client)
{
    $response = $client->syncInvoke($request);
}
```

#### 服务名访问

[](#服务名访问)

```
public function getCities()
{
    $response = app('MeituanPubUnion')->syncInvoke($request);
}
```

参考
--

[](#参考)

- [美团分销联盟API文档](https://pub.meituan.com/#/api-doc)

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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

Every ~67 days

Total

4

Last Release

1480d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10205742?v=4)[will-gao](/maintainers/gaowei-space)[@gaowei-space](https://github.com/gaowei-space)

---

Top Contributors

[![liaoshengping](https://avatars.githubusercontent.com/u/24541157?v=4)](https://github.com/liaoshengping "liaoshengping (2 commits)")[![gaowei-space](https://avatars.githubusercontent.com/u/10205742?v=4)](https://github.com/gaowei-space "gaowei-space (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

laravellaravel-packagemeituan-sdkphpphp-librarywaimai

### Embed Badge

![Health badge](/badges/gaowei-space-meituan-pub-union/health.svg)

```
[![Health](https://phpackages.com/badges/gaowei-space-meituan-pub-union/health.svg)](https://phpackages.com/packages/gaowei-space-meituan-pub-union)
```

###  Alternatives

[statamic/cms

The Statamic CMS Core Package

4.8k3.6M981](/packages/statamic-cms)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[avalara/avataxclient

Client library for Avalara's AvaTax suite of business tax calculation and processing services. Uses the REST v2 API.

528.5M7](/packages/avalara-avataxclient)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)[aimeos/prisma

A powerful PHP package for integrating media related Large Language Models (LLMs) into your applications

1943.1k5](/packages/aimeos-prisma)

PHPackages © 2026

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