PHP code example of busyphp / wechat-mini

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

    

busyphp / wechat-mini example snippets


\BusyPHP\wechat\mini\app\controller\ServiceController::url(string $programId = '');

return [
    'mini' => [
        // 小程序名称
        'name' => '',

        // 小程序 App Id
        'app_id'     => '',
        
        // 小程序 App Secret
        'app_secret' => '',
    
        // 服务器token
        'token'      => '',
        
        // todo 暂无意义
        // 消息加解密密钥 (EncodingAESKey)
        'encodingAESKey' => '',

        // 多小程序配置
        'multi'      => [
            '自定义标识' => [
                // 小程序名称
                'name'           => '',
                'app_id'         => '',
                'app_secret'     => '',
                'token'          => '',
                'encodingAESKey' => '',
            ]
        ],
        
        // 配置事件监听
        'listen' => [
            // 事件名称 => 事件类,需要实现handle方法,方法参数为本事件名类对象
            BusyPHP\wechat\mini\event\UserEnterTempSessionEvent::class => '',
            BusyPHP\wechat\mini\event\MiniProgramPageEvent::class      => '',
            BusyPHP\wechat\mini\event\TextEvent::class                 => '',
            BusyPHP\wechat\mini\event\ImageEvent::class                => '',
        ]
    ]
];