PHP code example of amulet / amulet-tools

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

    

amulet / amulet-tools example snippets


use Amulet\Wechat\Wechat;

#$options = [
	'token'=> '',
	'encodingAesKey'=> '',
	'appid'=> '',
	'appsecret'=> '',
	....
];

#实例化
$wechat = new Wechat((array)$options);
#验证是否是微信服务器请求
$wechat->checkSignature($query);

use Amulet\Wechat\{Wechat, Receive};

#$options = [
	'token'=> '',
	'encodingAesKey'=> '',
	'appid'=> '',
	'appsecret'=> '',
	....
];

#实例化
$wechat = new Wechat((array)$options);
#验证是否是微信服务器请求
$wechat->checkSignature($query);

#接收微信事件推送消息 实例化
// 实例化消息对象
$recv = Receive::instance((array)$options);