PHP code example of fastwhale / yii2-wechat

1. Go to this page and download the library: Download fastwhale/yii2-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/ */

    

fastwhale / yii2-wechat example snippets


/** @var Wechat $wechat */
$wechat = \Yii::createObject([
    'class'     => Wechat::className(),
    'appId'     => $appid,
    'appSecret' => $appSecret,
    'token'     => $token,
]);

/** @var Wechat $wechat */
$wechat = \Yii::createObject([
    'class'          => Wechat::className(),
    'appId'          => $appid,
    'appSecret'      => $appSecret,
    'token'          => $token,
    'componentAppId' => $componentAppId,
]);

/** @var Wechat $wechat */
$wechat = \Yii::createObject([
    'class'                 => Wechat::className(),
    'appId'                 => $appid,
    'appSecret'             => $appSecret,
    'token'                 => $token,
    'componentAppId'        => $componentAppId,
    '_componentAccessToken' => $componentAccessToken,
]);

php composer.phar