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(5mo ago)1367↓50%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 1mo ago

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

43

—

FairBetter than 91% of packages

Maintenance79

Regular maintenance activity

Popularity18

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

161d ago

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

1.1.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fd8a914f7aa732b7bf15b7b4aacfed35e24dbdc5e278a5f4f047c6f85e383ec?d=identicon)[siganushka](/maintainers/siganushka)

---

Top Contributors

[![siganushka](https://avatars.githubusercontent.com/u/45844370?v=4)](https://github.com/siganushka "siganushka (130 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

[phpdocumentor/phpdocumentor

Documentation Generator for PHP

4.4k3.1M878](/packages/phpdocumentor-phpdocumentor)[thecodingmachine/graphqlite

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

5723.1M30](/packages/thecodingmachine-graphqlite)[contentful/contentful

SDK for the Contentful Content Delivery API

1173.9M18](/packages/contentful-contentful)[typhonius/acquia-php-sdk-v2

A PHP SDK for Acquia CloudAPI v2

222.8M7](/packages/typhonius-acquia-php-sdk-v2)[commercetools/commercetools-sdk

The official PHP SDK for the commercetools Composable Commerce APIs

19281.5k](/packages/commercetools-commercetools-sdk)[oxid-esales/graphql-base

OXID eSales GraphQL base module

24101.0k10](/packages/oxid-esales-graphql-base)

PHPackages © 2026

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