musoftware/botman-vk-driver

Vk driver for BotMan

0.0.4 2019-01-22 15:42 UTC

This package is auto-updated.

Last update: 2024-10-12 22:50:37 UTC


README

Driver for Botman library

Example Conversation Class

<?php
namespace App\Conversation;

use VkBotMan\Model\AbstractConversation;

/**
 * Class EntryPointConversation
 */
class EntryPointConversation extends AbstractConversation
{
  //... logic your conversation
}

Example Using Conversation (Symfony framework)

<?php
namespace App\Controller;

use App\Conversation\EntryPointConversation;
//...

class VkController extends AbstractController
{
    /**
     * @Route("/app/callback", methods={"POST"}, name="app_callback")
     * @param Request $request
     * @return Response
     */
    public function callback(
        Request $request
    )
    {
        $vkApiHandler = new VkApiHandler();
  
        $handler = new BotManHandler(
            $request,
            $vkApiHandler
        );

        $handler->attachConversation(new EntryPointConversation());

        return new Response();
    }
}

Packagist link