PHPackages                             iboldurev/dialogflow - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. iboldurev/dialogflow

ActiveLibrary[API Development](/categories/api)

iboldurev/dialogflow
====================

Dialogflow php sdk

0.3.0(8y ago)16540.5k↓33.3%60[3 PRs](https://github.com/iboldurev/dialogflow/pulls)1MITPHPPHP &gt;=5.5.0

Since Aug 20Pushed 7y ago11 watchersCompare

[ Source](https://github.com/iboldurev/dialogflow)[ Packagist](https://packagist.org/packages/iboldurev/dialogflow)[ RSS](/packages/iboldurev-dialogflow/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (5)Used By (1)

DialogFlow PHP sdk
==================

[](#dialogflow-php-sdk)

[![version](https://camo.githubusercontent.com/40c1e7cda564d7bb951de717aaee0d9c877084bf258bab695a91926ce739c892/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69626f6c64757265762f6469616c6f67666c6f772e7376673f7374796c653d666c6174)](https://packagist.org/packages/iboldurev/dialogflow)[![Downloads](https://camo.githubusercontent.com/bab828081e19dc54b8345bdc5c3f3ffa27e8078ec13aa9006e98f98f0b5906eb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f69626f6c64757265762f6469616c6f67666c6f772e7376673f7374796c653d666c6174)](https://packagist.org/packages/iboldurev/dialogflow)

This is an unofficial php sdk for [Dialogflow](https://dialogflow.com) and it's still in progress...

```
Dialogflow: Build brand-unique, natural language interactions for bots, applications and devices.

```

Install:
--------

[](#install)

Via composer:

```
$ composer require iboldurev/dialogflow

```

Usage:
------

[](#usage)

Using the low level `Client`:

```
require_once __DIR__.'/vendor/autoload.php';

use DialogFlow\Client;

try {
    $client = new Client('access_token');

    $query = $client->get('query', [
        'query' => 'Hello',
    ]);

    $response = json_decode((string) $query->getBody(), true);
} catch (\Exception $error) {
    echo $error->getMessage();
}
```

Usage:
------

[](#usage-1)

Using the low level `Query`:

```
require_once __DIR__.'/vendor/autoload.php';

use DialogFlow\Client;
use DialogFlow\Model\Query;
use DialogFlow\Method\QueryApi;

try {
    $client = new Client('access_token');
    $queryApi = new QueryApi($client);

    $meaning = $queryApi->extractMeaning('Hello', [
        'sessionId' => '1234567890',
        'lang' => 'en',
    ]);
    $response = new Query($meaning);
} catch (\Exception $error) {
    echo $error->getMessage();
}
```

Usage
-----

[](#usage-2)

Using the low level asynchronous api:

```
require_once __DIR__.'/vendor/autoload.php';

use DialogFlow\Client;
use DialogFlow\Model\Query;
use DialogFlow\Method\QueryApi;
use GuzzleHttp\HandlerStack;
use React\EventLoop\Factory;
use WyriHaximus\React\GuzzlePsr7\HttpClientAdapter;

$loop = Factory::create();
$reactGuzzle = new \GuzzleHttp\Client([
    'base_uri' => Client::API_BASE_URI . Client::DEFAULT_API_ENDPOINT,
    'timeout' => Client::DEFAULT_TIMEOUT,
    'connect_timeout' => Client::DEFAULT_TIMEOUT,
    'handler' => HandlerStack::create(new HttpClientAdapter($loop))
]);

$client = new Client('bc0a6d712bba4b3c8063a9c7ff0fa4ea', new DialogFlow\HttpClient\GuzzleHttpClient($reactGuzzle));
$queryApi = new QueryApi($client);

$queryApi->extractMeaningAsync('Hello', [
    'sessionId' => '123456789',
    'lang' => 'en'
])->then(
    function ($meaning) {
        $response = new Query($meaning);
    },
    function ($error) {
        echo $error;
    }
);

$loop->run();
```

Dialog
------

[](#dialog)

The `Dialog` class provides an easy way to use the `query` api and execute automatically the chaining steps :

First, you need to create an `ActionMapping` class to customize the actions behavior.

```
namespace Custom;

class MyActionMapping extends ActionMapping
{
    /**
     * @inheritdoc
     */
    public function action($sessionId, $action, $parameters, $contexts)
    {
        return call_user_func_array(array($this, $action), array($sessionId, $parameters, $contexts));
    }

    /**
     * @inheritdoc
     */
    public function speech($sessionId, $speech, $contexts)
    {
        echo $speech;
    }

    /**
     * @inheritdoc
     */
    public function error($sessionId, $error)
    {
        echo $error;
    }
}
```

And using it in the `Dialog` class.

```
require_once __DIR__.'/vendor/autoload.php';

use DialogFlow\Client;
use DialogFlow\Method\QueryApi;
use DialogFlow\Dialog;
use Custom\MyActionMapping;

try {
    $client = new Client('access_token');
    $queryApi = new QueryApi($client);
    $actionMapping = new MyActionMapping();
    $dialog = new Dialog($queryApi, $actionMapping);

    // Start dialog ..
    $dialog->create('1234567890', 'Привет', 'ru');

} catch (\Exception $error) {
    echo $error->getMessage();
}
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~217 days

Total

3

Last Release

3125d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fea960b6c20f3a1a85009239524553016de5d5441e63e3f61d17baae2abcd82e?d=identicon)[iboldurev](/maintainers/iboldurev)

---

Top Contributors

[![iboldurev](https://avatars.githubusercontent.com/u/17103170?v=4)](https://github.com/iboldurev "iboldurev (29 commits)")[![aleplusplus](https://avatars.githubusercontent.com/u/6319838?v=4)](https://github.com/aleplusplus "aleplusplus (1 commits)")[![CthulhuDen](https://avatars.githubusercontent.com/u/3912367?v=4)](https://github.com/CthulhuDen "CthulhuDen (1 commits)")[![pattyland](https://avatars.githubusercontent.com/u/838758?v=4)](https://github.com/pattyland "pattyland (1 commits)")[![pilot](https://avatars.githubusercontent.com/u/28564?v=4)](https://github.com/pilot "pilot (1 commits)")

---

Tags

aiapiapi-clientapiaibotapi.aiDialogflowDialogflow sdk

### Embed Badge

![Health badge](/badges/iboldurev-dialogflow/health.svg)

```
[![Health](https://phpackages.com/badges/iboldurev-dialogflow/health.svg)](https://phpackages.com/packages/iboldurev-dialogflow)
```

###  Alternatives

[longman/telegram-bot

PHP Telegram bot

4.0k2.1M50](/packages/longman-telegram-bot)[linecorp/line-bot-sdk

SDK of the LINE BOT API for PHP

7323.0M21](/packages/linecorp-line-bot-sdk)[telegram-bot-php/core

A PHP library that makes using Telegram Bot API much easier.

60293.1k](/packages/telegram-bot-php-core)[tgallice/fb-messenger-sdk

Facebook Messenger Bot php sdk

9315.2k](/packages/tgallice-fb-messenger-sdk)[klev-o/telegram-bot-api

Simple and convenient object-oriented implementation Telegram bot API with php version ^7.4 support. You'll like it)

457.8k1](/packages/klev-o-telegram-bot-api)[bushlanov-dev/max-bot-api-client-php

Max Bot API Client library

281.6k](/packages/bushlanov-dev-max-bot-api-client-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
