2017 © Pedro Peláez
 

yii2-extension yii2-easy-wechat

Easywechat sdk for yii2 php framework

image

myshero/yii2-easy-wechat

Easywechat sdk for yii2 php framework

  • Monday, May 7, 2018
  • by myshero
  • Repository
  • 0 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

yii2-easy-wechat

借鉴了一些其他 EasyWeChat SDK for Yii2,但好像都是针对 EasyWeChat V3 版本的。, (*1)

本渣瞎捣鼓了一个针对 EasyWeChat V4 的,欢迎各路大佬指点。, (*2)

Thank you., (*3)

Installation

composer require myshero/yii2-easy-wechat --dev, (*4)

Configuration

YII2 配置添加 wechat 组件, (*5)

更多参数说明, (*6)

'components' => [
    // ...
    'wechat'=>[
        'class'=>'Myshero\Wechat\Wechat',
        // 微信参数
        'config' => [
            'app_id' => 'app_id',
            'secret' => 'secret',
            'log' => [
                'level' => 'debug',
                'permission' => 0777,
                'file' => Yii::getAlias("@frontend") . '/runtime/wechat.log',
            ],
            /**
             * OAuth 配置
             *
             * scopes:公众平台(snsapi_userinfo / snsapi_base),开放平台:snsapi_login
             * callback:OAuth授权完成后的回调页地址
             */
            'oauth' => [
                'scopes' => ['snsapi_userinfo'],
                'callback' => 'wechat/oauth',
            ],
        ],
    ],
    // ...
],

Usage

// here are some representative examples that will help you:

// 微信网页授权:
public function actionIndex()
{
    $wechat = \Yii::$app->wechat;
    if ($wechat->isGuest()) {
        // 跳转微信服务器授权
        return $wechat->prepareOauth();
    }else{
        // do something ...
    }
}

/**
 * 授权回调
 */
public function actionOauth()
{
    $wechat = \Yii::$app->wechat;
    return $wechat->oauth();
}

------

\Yii::$app->wechat->officialAccount;  // 公众号
\Yii::$app->wechat->miniProgram;      // 小程序
\Yii::$app->wechat->openPlatform;     // 开放平台
\Yii::$app->wechat->payment;          // 微信支付
\Yii::$app->wechat->work;             // 企业微信

More documentation

see EasyWeChat Docs., (*7)

Thanks to overtrue/wechat, (*8)

The Versions

07/05 2018

dev-master

9999999-dev

Easywechat sdk for yii2 php framework

  Sources   Download

MIT

The Requires

 

by Er Qiao

07/05 2018

0.1.1

0.1.1.0

Easywechat sdk for yii2 php framework

  Sources   Download

MIT

The Requires

 

by Er Qiao

04/05 2018

0.1

0.1.0.0

Easywechat sdk for yii2 php framework

  Sources   Download

MIT

The Requires

 

by Er Qiao