GithubHelp home page GithubHelp logo

uiste / yii2-wx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abei2017/yii2-wx

0.0 2.0 0.0 81 KB

这可能是yii2中最好用的微信SDK🔥🔥🔥

Home Page: https://nai8.me/lang-7.html

PHP 100.00%

yii2-wx's Introduction

为了更好的维护这个项目,避免多点分心。答疑和bug提交请在我的知识分享( 点击进入 )讨论页面提交,选择标签yii2-wx。

yii2-wx Logo

一款服务于yii2的微信SDK(公众号、小程序、开放平台和企业微信)


感谢下面伙伴的支持

https://nai8.me

北哥小报

除了代码,还有诗和远方。扫码关注我的公众号。

文档

系统需求(Requirement)

  • PHP >= 5.4
  • Composer
  • openssl
  • fileinfo

安装(Installation)

$ composer require "abei2017/yii2-wx" -vvv

配置(set)

配置参数建议存放到yii2的配置文件中,例如基础版yii2可以如下配置

return [
    'wx'=>[
        //  公众号信息
        'mp'=>[
            //  账号基本信息
            'app_id'  => '', // 公众号的appid
            'secret'  => '', // 公众号的秘钥
            'token'   => '', // 接口的token
            'encodingAESKey'=>'',
            'safeMode'=>0,

            //  微信支付
            'payment'=>[
                'mch_id'        =>  '',// 商户ID
                'key'           =>  '',// 商户KEY
                'notify_url'    =>  '',// 支付通知地址
                'cert_path'     => '',// 证书
                'key_path'      => '',// 证书
            ],

            // web授权
            'oauth' => [
                'scopes'   => 'snsapi_userinfo',// 授权范围
                'callback' => '',// 授权回调
            ],
        ],

        //  小程序配置
        'mini'=>[
            //  基本配置
            'app_id'  => '', 
            'secret'  => '',
            //  微信支付
            'payment' => [
                'mch_id'        => '',
                'key'           => '',
            ],
        ]
    ]
];

对于配置,请不要修改数据的key值。

使用(use)

yii2-wx采用单一接口驱动功能的思路,比如下面的代码将生成一个微信带参数的二维码。

use abei2017\wx\Application;

$conf = Yii::$app->params['wx']['mp'];
$app = new Application(['conf'=>$conf]);

$qrcode = $app->driver('mp.qrcode');
$data = $qrcode->intTemp(3600,9527);// 生成一个数字类临时二维码,有效期为3600秒

功能实现

微信公众号

  • 获取接口调用凭证
  • 获取微信服务器IP地址
  • 验证消息真实性
  • 服务器接收实现
  • 客户端响应相关接口
  • 带参数的二维码
  • 用户管理
  • 素材管理
  • 菜单管理
  • 消息模板发送
  • web授权机制
  • JSSDK
  • 微信支付(扫码支付/公众号浏览器支付)
  • 企业付款到零钱包
  • 现金红包

微信小程序

  • 小程序码
  • 小程序的微信支付
  • 小程序模板

学习yii2-wx(learning yii2-wx)

北哥已将yii2-wx的配置和使用设计的简单易懂,因此通过文档和速查表你可以轻松的学会它,但是这也需要你之前对微信相关文档有所阅读。

如果你是一名yii2或微信接口开发的初学者,我在自己的知识分享设置了一套针对性的视频课程(点击查看),我想能让你零起步。

支持(Support)

更多请参考 https://nai8.me/lang-7.html

一些有用的帖子

开源协议(License)

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.