PHP code example of zyan / wechat-factory

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

    

zyan / wechat-factory example snippets


use Zyan\WechatFactory\WechatFactory;

$config = [
    'app_id' => 'wx3cf0f39249eb0exx',
    'secret' => 'f1c242f4f28f735d4687abb469072axx',
    'token' => 'easywechat',
    'aes_key' => '' // 明文模式请勿填写 EncodingAESKey
    //...
];

//小程序
$app = WechatFactory::miniApp($config);

//微信公众号
$app = WechatFactory::officialAccount($config);

//微信开放平台
$app = WechatFactory::openPlatform($config);

//企业微信开放平台
$app = WechatFactory::openWork($config);

//微信支付
$app = WechatFactory::pay($config);

//企业微信
$app = WechatFactory::work($config);