peijunyang/yii2-wechat

Wechat Component For Yii2

Installs: 40

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Type:yii2-extension

1.1 2016-04-09 14:07 UTC

This package is not auto-updated.

Last update: 2024-09-25 23:19:08 UTC


README

Wechat Component For Yii2

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist peijunyang/yii2-wechat "*"

or add

"peijunyang/yii2-wechat": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply modify your application configuration as follows:

return [
    ...
    'components' => [
        ....
        'wechat' => [
            'class' => 'peijunyang\wechat\Component',
            'config' => [
                'type'=>'common', // 微信账号类型, common 普通, qy 企业
                'token'=>'tokenaccesskey', //填写你设定的key
                'encodingaeskey'=>'encodingaeskey', //填写加密用的EncodingAESKey
                'appid'=>'wxdk1234567890', //填写高级调用功能的app id, 请在微信开发模式后台查询
                'appsecret'=>'xxxxxxxxxxxxxxxxxxx' //填写高级调用功能的密钥
            ],
        ]
    ],
];

Use it in your code by :

$weObj = Yii::$app->wechat->getWechat(); //获取wechat对象实例
 //TODO:调用$weObj各实例方法

For full details on usage, see the api wiki.