1. Go to this page and download the library: Download catferq/reactphp-vk 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/ */
catferq / reactphp-vk example snippets
use ReactPHPVK\Client\AVKClient;
use ReactPHPVK\LongPoll\LongPollClient;
use React\EventLoop\Factory;
VKClient($loop, $accessToken);
$method = $avk->messages()->send();
$method->setMessage('Hello world');
$method->setUserId(283776198);
$method->execute()->then(
fn ($response) => var_dump($response)
);
$loop->run();
use ReactPHPVK\Client\AVKClient;
use ReactPHPVK\LongPoll\LongPollClient;
use React\EventLoop\Factory;
create();
$avk = new AVKClient($loop, $accessToken);
$lp = new LongPollClient($avk, $groupId);
$lp->handle(
fn ($update) => var_dump($update) // выведет событие (неожиданно, согласен)
);
$loop->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.