sjdskl/swxbot

该包最新版本(0.04)没有可用的许可证信息。

微信网页登录和任务

0.04 2017-04-12 09:44 UTC

This package is not auto-updated.

Last update: 2024-09-23 06:37:02 UTC


README

Guzzle 是一个 PHP 微信客户端,可以登录、发送消息以及执行您想要的功能。

  • 示例登录微信
#create and add logininfo
$swxbot = new swxbot\Core\WeChat(swxbot\Library\Login\Logininfo::getInstance());
#show qrcode
$swxbot->showQrCode();
#login
$swxbot->login();
  • 多进程
#create process
$process = new swxbot\Library\Progress\ProgressPcntl();
#run background
$process->runBackground();
#create new process to run your code
$process->run(function () use ($swxbot) {
    echo "i am sjdskl1\n";
}, 'swxbot-process1');
$process->run(function () use ($swxbot) {
    echo "i am sjdskl2\n";
}, 'swxbot-process2');
  • 任务
#use process run tasks, your task need extends abstractTasks
$process->runTask(new \Library\Tasks\TzgLog($swxbot), 
array(
    'php-act-root-dir' => '/opt/web-data/php-act',
    'sleep_time' => 5,
    'monitor_files' => array('sql_error')
), 
'swxbot-log-notify');
  • 监听消息助手
#you can user helper to handle the message
$helper = new swxbot\Library\Helper\ListenMessageHelper();
$helper->add('test', new swxbot\Library\ListenMessage\TestListenMessage());
$helper->add('test2', new swxbot\Library\ListenMessage\TestListenMessage2());
$swxbot->setListenHelper($helper);
$process->runBackground();
$process->run(function () use ($swxbot) {
    $swxbot->listenMessage();
}, 'swxbot-listen-message');