PHPackages                             ogrethegreat/api-ai-php - 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. ogrethegreat/api-ai-php

ActiveLibrary[API Development](/categories/api)

ogrethegreat/api-ai-php
=======================

API.ai php sdk

0.2.5(9y ago)06941MITPHPPHP &gt;=5.5.0

Since Aug 20Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ogrethegreat/api-ai-php)[ Packagist](https://packagist.org/packages/ogrethegreat/api-ai-php)[ RSS](/packages/ogrethegreat-api-ai-php/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Api.ai PHP sdk
==============

[](#apiai-php-sdk)

[![version](https://camo.githubusercontent.com/edc835a9241d92c2deb966f1dea0eb619514edbed3e615800175d3f70baa654a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f69626f6c64757265762f6170692d61692d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/iboldurev/api-ai-php)[![Downloads](https://camo.githubusercontent.com/d77df8be3f8c0140fff6a0bd5a1480c6e918a09212158c8c3a7986fa4b41ee74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f69626f6c64757265762f6170692d61692d7068702e7376673f7374796c653d666c6174)](https://packagist.org/packages/iboldurev/api-ai-php)

This is an unofficial php sdk for [Api.ai](https://api.ai) and it's still in progress...

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

```

Install:
--------

[](#install)

Via composer:

```
$ composer require iboldurev/api-ai-php

```

Usage:
------

[](#usage)

Using the low level `Client`:

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

use ApiAi\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 ApiAi\Client;
use ApiAi\Model\Query;
use ApiAi\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();
}
```

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 ApiAi\Client;
use ApiAi\Method\QueryApi;
use ApiAi\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();
}
```

Some examples are describe in the [iboldurev/api-ai-php-example](https://github.com/iboldurev/api-ai-php-example) repository.

###  Health Score

26

—

LowBetter than 40% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 82.6% 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

Unknown

Total

1

Last Release

3646d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2831721?v=4)[Josh Phipps](/maintainers/ogrethegreat)[@ogrethegreat](https://github.com/ogrethegreat)

---

Top Contributors

[![iboldurev](https://avatars.githubusercontent.com/u/17103170?v=4)](https://github.com/iboldurev "iboldurev (19 commits)")[![ogrethegreat](https://avatars.githubusercontent.com/u/2831721?v=4)](https://github.com/ogrethegreat "ogrethegreat (2 commits)")[![aleplusplus](https://avatars.githubusercontent.com/u/6319838?v=4)](https://github.com/aleplusplus "aleplusplus (1 commits)")[![pilot](https://avatars.githubusercontent.com/u/28564?v=4)](https://github.com/pilot "pilot (1 commits)")

---

Tags

botapi.aiapi.ai sdk

### Embed Badge

![Health badge](/badges/ogrethegreat-api-ai-php/health.svg)

```
[![Health](https://phpackages.com/badges/ogrethegreat-api-ai-php/health.svg)](https://phpackages.com/packages/ogrethegreat-api-ai-php)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.3M49](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

353.6k](/packages/eslazarev-wildberries-sdk)[linecorp/line-bot-sdk

SDK of the LINE BOT API for PHP

7353.3M22](/packages/linecorp-line-bot-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2482.9k](/packages/filescom-files-php-sdk)[bushlanov-dev/max-bot-api-client-php

Max Bot API Client library

488.7k](/packages/bushlanov-dev-max-bot-api-client-php)[volcengine/volcengine-php-sdk

119.5k](/packages/volcengine-volcengine-php-sdk)

PHPackages © 2026

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