1. Go to this page and download the library: Download asil/vkmarket 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/ */
asil / vkmarket example snippets
use Asil\VkMarket\VkConnect;
use Asil\VkMarket\VkServiceDispatcher;
$accessToken = 'dbe359235b784';
$ownerId = 741281; // идентификатор владельца группы
$groupId = 101234567; // идентификатор группы
$connect = new VkConnect($accessToken, $groupId, $ownerId);
$vkService = new VkServiceDispatcher($connect);
use Asil\VkMarket\Model\Photo;
use Asil\VkMarket\Model\Product;
$product = new Product('Товар 1', 'Описание товара...', 3, 212);
$photo = new Photo();
$photo->createMainPhoto('/img/1.jpg');
$photo->createAdditionalPhoto([
'/img/1_1.jpg',
'/img/1_2.jpg'
]);
$id = $vkService->addProduct($product, $photo);
use Asil\VkMarket\Model\Photo;
use Asil\VkMarket\Model\Product;
$product = $vkService->getProductById(1432679);
$product->setName('Тестовый товар 2');
$photo = new Photo();
$photo->createAdditionalPhoto([
'/img/6.jpg'
]);
$vkService->editProduct($product, $photo);
$vkService->deactivateProduct(1432679);
$vkService->restoreProduct(1432679);
$vkService->deleteProduct(1432679);
use Asil\VkMarket\Model\Photo;
use Asil\VkMarket\Model\Album;
$album = new Album('Альбом 1');
$photo = new Photo();
$photo->createAlbumPhoto('/img/album_1.jpg');
$vkService->addAlbum($album, $photo);