PHP code example of qbhy / mirai

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

    

qbhy / mirai example snippets


$bot = new \Qbhy\Mirai\Bot([
    'debug' => true,

    'host' => 'http://localhost:8000',

    'auth_key' => 'your auth key',
]);

$bot->auth; // 授权相关接口
$bot->plugin; // 插件相关接口
$bot->manager; // 管理相关接口
$bot->message; // 消息相关接口

// 给指定还有发送文本消息
$bot->message->sendFriendMessage(572490755, [
    \Qbhy\Mirai\Util\MessageUtil::plain('文本消息'),
]);