PHP code example of labile / vk-data-fetcher
1. Go to this page and download the library: Download labile/vk-data-fetcher 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/ */
labile / vk-data-fetcher example snippets
declare(strict_types=1);
use Astaroth\DataFetcher\DataFetcher;
$input_data = json_decode("vk json object", false);
$data = new DataFetcher($input_data);
$raw_data = $data->getRawData();
//$raw_data->...
if ($data->getType() === "message_new"){
$message_new = $data->messageNew();
$message_new->getText();
$message_new->getAttachments();
$message_new->getFromId();
$message_new->getPayload();
//...
}
if ($data->getType() === "message_event"){
$message_event = $data->messageEvent();
$message_event->getConversationMessageId();
$message_event->getPeerId();
$message_event->getEventId();
$message_event->getChatId();
//...
}