PHPackages                             fpy/tuangou - 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. fpy/tuangou

ActiveLibrary[API Development](/categories/api)

fpy/tuangou
===========

sdk of dianping/tuangou

1.0.0(7y ago)2161[2 PRs](https://github.com/fpy5627/dianping-tuangou/pulls)MITPHP

Since Jan 22Pushed 7y agoCompare

[ Source](https://github.com/fpy5627/dianping-tuangou)[ Packagist](https://packagist.org/packages/fpy/tuangou)[ RSS](/packages/fpy-tuangou/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

 tuangou
=========

[](#-tuangou-)

 [ ![Build Status](https://camo.githubusercontent.com/a6e153791f35c761d925ec8e13c4eeaa227d187b8e6e2709eb2c69ac1d921895/68747470733a2f2f7472617669732d63692e6f72672f667079353632372f6469616e70696e672d7475616e676f752e7376673f6272616e63683d6d6173746572) ](https://travis-ci.org/fpy5627/dianping-tuangou) [![](https://camo.githubusercontent.com/2f93654bcb40fe7c666ee15d31758ef7ee70c4a59237bc2e5b94734900016928/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246667079353632372532466469616e70696e672d7475616e676f752e7376673f747970653d736869656c64)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffpy5627%2Fdianping-tuangou?ref=badge_shield)

 sdk of dianping/tuangou.

 北极星开放平台,美团api接口SDK

环境需求
----

[](#环境需求)

- PHP &gt;= 5.6

Installing/安装
-------------

[](#installing安装)

```
$ composer require fpy/tuangou
```

Usage/使用
--------

[](#usage使用)

只有团购的api,以及自用型应用、工具型应用授权,新版接口不推荐使用app\_shop\_id,因此本sdk只使用open\_shop\_uuid

### 授权

[](#授权)

商家通过接入授权UI，可获取到对应的auth\_code，通过此接口获取此次发起授权的session。

```
use Fpy\TuanGou\Session;
$session = new Session($appKey, $appSecret);
//session换取接口
$session->getToken($authCode,$redirectUrl=null);

//session刷新接口
$session->refreshToken($refreshToken);

//session范围查询接口
$session->sessionQuery($session);

//session适用店铺查询接口
$session->getScope($bid,$session);
```

### 团购

[](#团购)

```
use Fpy\TuanGou\TuanGou;
$tuangou = new TuanGou($appKey, $appSecret);

//输码验券校验接口
$tuangou->prepare($receiptCode, $openShopUuid, $session);

//扫码验券校验接口
$tuangou->scanPrepare($receiptCode, $openShopUuid, $session);

//验券接口
$tuangou->consume($requestId, $code, $count, $openShopUuid, $session, $shopAccount, $shopAccountName);

//查询已验券信息接口
$tuangou->getConsumed($code, $openShopUuid, $session);

//验券记录
$tuangou->consumeHistory($date, $openShopUuid, $session, $type=0, $bizType=null, $pageIndex=1, $pageSize=10);

//撤销验券接口(超过10分钟不能退券)
$tuangou->reverseConsume($appDealId, $code, $openShopUuid, $session, $shopAccount, $shopAccountName)

//获取团购信息接口

$tuangou->queryShopDeal($openShopUuid, $session, $pageIndex=1, $pageSize=10);
```

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/fpy/tuangou/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/fpy/tuangou/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

[![FOSSA Status](https://camo.githubusercontent.com/e72c06dfd2c6eccb14e897bfede7d65dac85156875c586f50bb9c66cbaddc3db/68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246667079353632372532466469616e70696e672d7475616e676f752e7376673f747970653d6c61726765)](https://app.fossa.io/projects/git%2Bgithub.com%2Ffpy5627%2Fdianping-tuangou?ref=badge_large)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~0 days

Total

2

Last Release

2670d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/842054537604ab80b8121135fe14d49cee200d89161116820f55f6ed867ed5c1?d=identicon)[fpy5627](/maintainers/fpy5627)

---

Top Contributors

[![fpy5627](https://avatars.githubusercontent.com/u/24911692?v=4)](https://github.com/fpy5627 "fpy5627 (16 commits)")

### Embed Badge

![Health badge](/badges/fpy-tuangou/health.svg)

```
[![Health](https://phpackages.com/badges/fpy-tuangou/health.svg)](https://phpackages.com/packages/fpy-tuangou)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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