PHPackages                             siganushka/wechat-api - 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. siganushka/wechat-api

ActiveLibrary[API Development](/categories/api)

siganushka/wechat-api
=====================

Wechat API.

1.1.0(6mo ago)1386↓92.2%21MITPHPPHP &gt;=8.1CI passing

Since Sep 5Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/siganushka/wechat-api)[ Packagist](https://packagist.org/packages/siganushka/wechat-api)[ Docs](https://github.com/siganushka/wechat-api)[ RSS](/packages/siganushka-wechat-api/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (3)Versions (4)Used By (1)

Wechat API
==========

[](#wechat-api)

微信公众号、小程序和开放平台相关接口实现，基于 [siganushka/api-factory](https://github.com/siganushka/api-factory) 抽象层，可快速实现微信相关业务。

### 安装

[](#安装)

```
$ composer require siganushka/wechat-api
```

### 使用

[](#使用)

具体使用参考 `./example` 示例，运行示例前复制 `_config.php.dist` 文件为 `_config.php` 并修改相关参数，由于示例中包含了小程序、公众号和开放平台相关功能，因此对应功能修改对应参数即可。

目录包含以下示例：

文件功能example/affiaccount\_user.php微信公众号获取用户列表example/affiaccount\_userinfo.php微信公众号获取用户基本信息example/core\_callback\_ip.php获取微信 callback IP 地址example/core\_server\_ip.php获取微信服务器 IP 地址example/core\_ticket.php获取微信临时票据，用于微信 JS APIexample/core\_token.php获取全局 access\_tokenexample/core\_token\_stable.php获取全局稳定版 access\_tokenexample/jsapi\_config\_utils.php生成微信 JS API 配置参数example/miniapp\_qrcode.php获取小程序二维码example/miniapp\_session\_key.php获取小程序 session\_keyexample/miniapp\_wxacode.php获取小程序码example/miniapp\_wxacode\_unlimit.php获取不限制的小程序码example/oauth\_client.php网页授权example/oauth\_client\_qrcode.php网页授权（扫码登录）example/oauth\_user\_info.php根据用户 access\_token 获取用户信息example/oauth\_check\_token.php检验用户 access\_token 是否有效example/oauth\_refresh\_token.php刷新用户 access\_tokenexample/message\_subscribe.php发送小程序订阅消息example/template\_message.php发送模板消息### 框架集成

[](#框架集成)

`Symfony` 项目已集成至 [siganushka/api-factory-bundle](https://github.com/siganushka/api-factory-bundle)，将以服务的形式使用。

安装

```
$ composer require siganushka/wechat-api siganushka/api-factory-bundle
```

单个应用配置

```
# config/packages/siganushka_api_factory.yaml

siganushka_api_factory:
    wechat:
        appid: your_appid   # 微信公众号/小程序/开放平台帐号
        secret: your_secret # 微信公众号/小程序/开放平台秘钥
```

多个应用配置

```
# config/packages/siganushka_api_factory.yaml

siganushka_api_factory:
    wechat:
        default_configuration: foo
        configurations:
        # 将以 Siganushka\ApiFactory\Wechat\Configuration $fooConfiguration 被注入到服务
        foo:
            appid: your_appid
            secret: your_secret
        # 将以 Siganushka\ApiFactory\Wechat\Configuration $barConfiguration 被注入到服务
        bar:
            appid: your_appid
            secret: your_secret
```

使用

```
// src/Controller/DefaultController.php

use Siganushka\ApiFactory\Wechat\Core\Token;
use Siganushka\ApiFactory\Wechat\Configuration;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class DefaultController extends AbstractController
{
    public function index(Token $request)
    {
        // 使用默认配置，即 foo
        $result = $request->send();
        var_dump($result);
    }

    public function useBarConfig(Token $request, Configuration $barConfiguration)
    {
        // 使用 bar 覆盖默认配置
        $request->extend(new ConfigurationExtension($barConfiguration));

        $result = $request->send();
        var_dump($result);
    }
}
```

查看所有服务

```
$ php bin/console debug:container Siganushka\\ApiFactory\\Wechat
```

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance77

Regular maintenance activity

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

Every ~210 days

Total

2

Last Release

207d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.4

1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/45844370?v=4)[Siganushka](/maintainers/siganushka)[@siganushka](https://github.com/siganushka)

---

Top Contributors

[![siganushka](https://avatars.githubusercontent.com/u/45844370?v=4)](https://github.com/siganushka "siganushka (131 commits)")

---

Tags

wechat-api

### Embed Badge

![Health badge](/badges/siganushka-wechat-api/health.svg)

```
[![Health](https://phpackages.com/badges/siganushka-wechat-api/health.svg)](https://phpackages.com/packages/siganushka-wechat-api)
```

###  Alternatives

[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k251.7M11.6k](/packages/symfony-framework-bundle)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[thecodingmachine/graphqlite

Write your GraphQL queries in simple to write controllers (using webonyx/graphql-php).

5733.3M47](/packages/thecodingmachine-graphqlite)[oxid-esales/graphql-base

OXID eSales GraphQL base module

24107.6k16](/packages/oxid-esales-graphql-base)[psx/api

Parse and generate API specification formats

39183.3k5](/packages/psx-api)

PHPackages © 2026

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