2017 © Pedro Peláez
 

package dialogflowphp

A PHP-SDK for V1 of the Dialogflow API

image

0099ff/dialogflowphp

A PHP-SDK for V1 of the Dialogflow API

  • Tuesday, May 22, 2018
  • by 0099FF
  • Repository
  • 0 Watchers
  • 1 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 58 % Grown

The README.md

Dialogflow PHP

Unofficial PHP library for V1 of the Dialogflow API., (*1)

Install

composer require 0099ff/dialogflowphp

Usage

include "vendor/autoload.php";

use DialogflowPHP\Client;

$client = new Client('developer_access_token', 'session_id');
$response = $client->query("Hi Chatbot!");

echo $response->result->fulfillment->speech;

Hello, puny human, (*2)

echo $response->result->score;

0.91000002622604, (*3)

Agent responses can also be returned as a JSON string:, (*4)

$response = $client->query("Hi chatbot!", $return_as_json=true);
echo $response;

{ "id": "xxxx", "timestamp": "2018-05-05T09:52:25.905Z", "lang": "en", "result": { "source": "agent", "resolvedQuery": "Hi chatbot!", "action": "", "actionIncomplete": false, "parameters": {}, "contexts": [], "metadata": { "intentId": "xxxx", "webhookUsed": "false", "webhookForSlotFillingUsed": "false", "intentName": "Hey" }, "fulfillment": { "speech": "Hello, puny human", "messages": [ { "type": 0, "speech": "Hello, puny human" } ] }, "score": 0.9100000262260437 }, "status": { "code": 200, "errorType": "success" }, "sessionId": "session_id" }, (*5)

The Versions

22/05 2018

dev-master

9999999-dev

A PHP-SDK for V1 of the Dialogflow API

  Sources   Download

MIT

ai dialogflow