Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/levkopo/vk-api
Library for vk api
https://github.com/levkopo/vk-api
Last synced: 3 days ago
JSON representation
Library for vk api
- Host: GitHub
- URL: https://github.com/levkopo/vk-api
- Owner: levkopo
- License: apache-2.0
- Created: 2021-06-15T15:33:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-03T15:21:38.000Z (over 3 years ago)
- Last Synced: 2024-11-11T00:37:43.128Z (2 months ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Библиотека VK API
## Установка
```shell
composer require levkopo/vk-api
```### Примеры использования
**Callback бот**
```php
require_once 'vendor/autoload.php';
use levkopo\VKApi\CallbackApi;//Ключ доступа сообщества
const VK_ACCESS_TOKEN = "c0223f775444cf3d58a8a1442ec76a9571c8f58e3e24616d9440f73dc43022bbead9b2e576cb41d09c0a1";//Ключ для подтверждения адреса сервера из настроек Callback API
const VK_CONFIRM_KEY = "d8v2ve07";//Секретный ключ сервера из настроек Callback API
const VK_SECRET_KEY = "secret key";$vk = CallbackApi::group(VK_ACCESS_TOKEN,
confirmKey: VK_CONFIRM_KEY,
secret: VK_SECRET_KEY);
switch ($vk->data['type']){
case "messages_new":
$peerId = $vk->data['object']['message']['text'];
$vk->sendMessage($peerId, "Hello, World!");
break;
}
```