2017 © Pedro PelΓ‘ez
 

library yandex-dialogs-php-sdk

Yandex dialogs API PHP-wrapper

image

mesilov/yandex-dialogs-php-sdk

Yandex dialogs API PHP-wrapper

  • Wednesday, March 14, 2018
  • by mesilov
  • Repository
  • 2 Watchers
  • 7 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 400 % Grown

The README.md

yandex-dialogs-php-sdk

Π Π΅ΠΏΠΎΠ·ΠΈΡ‚ΠΎΡ€ΠΈΠΉ PHP-Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠΈ для облСгчСния Ρ€Π°Π±ΠΎΡ‚Ρ‹ с Π΄ΠΈΠ°Π»ΠΎΠ³Π°ΠΌΠΈ, (*1)

ΠŸΡ€ΠΈΠΌΠ΅Ρ€ использования

// ΠΏΠΎΠ»ΡƒΡ‡Π°Π΅ΠΌ входящий API-запрос
$apiRequestArray = json_decode(trim(file_get_contents('php://input')), true);


$dialogRequest = Yandex\Dialogs\Webhook\Request\Fabric::initFromArray($apiRequestArray);
$responseFabric = new Yandex\Dialogs\Webhook\Response\Fabric($dialogRequest);

$button1 = new Yandex\Dialogs\Webhook\Response\DTO\Buttons\Button();
$button1
    ->setTitle('Кнопка1')
    ->setUrl('https://ya.ru');

$button2 = new Yandex\Dialogs\Webhook\Response\DTO\Buttons\Button();
$button2
    ->setTitle('Кнопка2');

$response = $responseFabric
    ->setText('ΠŸΡ€ΠΈΠ²Π΅Ρ‚')
    ->setTts('ΠŸΡ€ΠΈΠ²Π΅Ρ‚')
    ->addButton($button1)
    ->addButton($button2)
    ->buildResponse();


header('Content-Type: application/json');
print(json_encode(Yandex\Dialogs\Webhook\Response\Formatters\Formatter::toArray($response), JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT));

The Versions

14/03 2018

dev-master

9999999-dev https://github.com/mesilov/yandex-dialogs-php-sdk

Yandex dialogs API PHP-wrapper

  Sources   Download

MIT

The Requires

  • php >=7.1
  • ext-json *

 

The Development Requires

api php yandex dialogs