PHP code example of nanxihang / wechat

1. Go to this page and download the library: Download nanxihang/wechat library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nanxihang / wechat example snippets


use Nanxihang\Wechat\ErrCode;

echo ErrCode::$OK; // 0
echo ErrCode::$ERROR_SYSTEM; // 90001

use Nanxihang\Wechat\QyErrCode;

echo QyErrCode::$OK; // 0
echo QyErrCode::$ERROR_INVALID_APPID; // 40013

src/
├── Internal/
│   ├── ErrorCode.php          # 错误码定义
│   ├── PKCS7Encoder.php       # PKCS7编码器
│   ├── Prpcrypt.php           # 加密解密类
│   └── QyErrorCode.php        # 企业微信错误码
├── errCode.php               # 公众号错误码常量
├── qyerrCode.php             # 企业微信错误码常量
└── WechatX.php              # 主SDK类
tests/
├── bootstrap.php            # 测试引导文件
├── WechatTest.php          # 主类测试
└── phpunit.xml             # PHPUnit配置
examples/
├── basic_usage.php         # 基础使用示例
├── corp_usage.php          # 企业微信示例
└── payment_usage.php       # 支付示例