meqy/vkrinochka
Composer 安装命令:
composer require meqy/vkrinochka
包简介
PHP Library for a easly calling to VkApi
README 文档
README
VkRinochka is a library for working with VKApi
Download
composer require meqy/vkrinochka=1.0.1
Examples
Simple example
<?php $access_token = ""; $confirmation_code = 1; $vk = new \vkrinochka\vkrinochka\Vk([ "access_token" => $access_token, "confirmation_code" => $confirmation_code ]); $vk->bot->hear("/hello/iu", function ($context){ $context->reply("Hello!"); }); $vk->bot->start();
Handle keyboard payload
<?php $access_token = ""; $confirmation_code = 1; $vk = new \vkrinochka\vkrinochka\Vk([ "access_token" => $access_token, "confirmation_code" => $confirmation_code ]); $vk->bot->hear(function ($val, $context) { return $context->getData()->getPayload()->command == "start"; }, function ($context){ $context->reply("Hello!"); });
Call Vk methods and get matched array
<?php $access_token = ""; $confirmation_code = 1; $vk = new \vkrinochka\vkrinochka\Vk([ "access_token" => $access_token, "confirmation_code" => $confirmation_code ]); $vk->bot->hear("/getName (\d+)/iu", function ($context) use ($vk) { $user = $vk ->method("users.get", ["user_ids" => $context->matched[1]])["items"][0]["first_name"]; $context ->reply("You search name of this user? - $user"); });
Future
- Add LongPolling
- Refactoring for code
- Add static typing for all variables
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-21