PHPackages                             tgallice/wit-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. tgallice/wit-php

ActiveLibrary[API Development](/categories/api)

tgallice/wit-php
================

Wit.ai php sdk

0.3.1(9y ago)7325.2k↓50%16[2 PRs](https://github.com/tgallice/wit-php/pulls)1MITPHPPHP &gt;=5.5.0

Since Apr 22Pushed 9y ago8 watchersCompare

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

READMEChangelog (4)Dependencies (2)Versions (6)Used By (1)

Wit.ai PHP sdk
==============

[](#witai-php-sdk)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/195175933007b9080557d24c7221e8b88941810d6beb7c11222255f8572974a9/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7467616c6c6963652f7769742d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tgallice/wit-php/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/7235a7ed31157f0ae70d2f1104b1853d7bdb9145e933ef765f69a354c8430299/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7467616c6c6963652f7769742d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/tgallice/wit-php/?branch=master)[![Build Status](https://camo.githubusercontent.com/ac34807f3e7b6c5fa1226ea6f373cb702453d16984258076069561b6bfaebfae/68747470733a2f2f7472617669732d63692e6f72672f7467616c6c6963652f7769742d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tgallice/wit-php)

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

```
Wit.ai: Easily create text or voice based bots that humans can chat with on their preferred messaging platform.

```

\## Install:

Via composer:

```
$ composer require tgallice/wit-php

```

Usage:
------

[](#usage)

Using the low level `Client`:

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

use Tgallice\Wit\Client;

$client = new Client('app_token');

$response = $client->get('/message', [
    'q' => 'Hello I live in London',
]);

// Get the decoded body
$intent = json_decode((string) $response->getBody(), true);
```

You can used the `Message` api class to extract meaning of a sentence:

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

use Tgallice\Wit\Client;
use Tgallice\Wit\MessageApi;

$client = new Client('app_token');
$api = new MessageApi($client);

$meaning = $api->extractMeaning('Hello I live in London');
```

Conversation
------------

[](#conversation)

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

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

```
namespace Custom;

use Tgallice\Wit\Model\Step\Action;
use Tgallice\Wit\Model\Step\Message;

class MyActionMapping extends ActionMapping
{
    /**
     * @inheritdoc
     */
    public function action($sessionId, Context $context, Action $step)
    {
        return call_user_func_array(array($this, $step->getAction()), array($sessionId, $context));
    }

    /**
     * @inheritdoc
     */
    public function say($sessionId, Context $context, Message $step)
    {
        echo $step->getMessage();
    }

     ....
}
```

And using it in the `Conversation` class.

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

use Tgallice\Wit\Client;
use Tgallice\Wit\ConverseApi;
use Tgallice\Wit\Conversation;
use Custom\MyActionMapping;

$client = new Client('app_token');
$api = new ConverseApi($client);
$actionMapping = new MyActionMapping();
$conversation = new Conversation($api, $actionMapping);

$context = $conversation->converse('session_id', 'Hello I live in London');
```

`Conversation::converse()` return the last available `Context`.

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

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.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 ~36 days

Total

4

Last Release

3568d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c17b24f359a7df6f9d2bf980a4827443c71a3273c4d5a45db11001fa6cd5d2d?d=identicon)[tgallice](/maintainers/tgallice)

---

Top Contributors

[![tgallice](https://avatars.githubusercontent.com/u/860533?v=4)](https://github.com/tgallice "tgallice (20 commits)")[![hfinck](https://avatars.githubusercontent.com/u/661811?v=4)](https://github.com/hfinck "hfinck (2 commits)")

---

Tags

botchatbotwit.aiwit.ai sdkchat bot

### Embed Badge

![Health badge](/badges/tgallice-wit-php/health.svg)

```
[![Health](https://phpackages.com/badges/tgallice-wit-php/health.svg)](https://phpackages.com/packages/tgallice-wit-php)
```

###  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)[iboldurev/dialogflow

Dialogflow php sdk

16540.5k1](/packages/iboldurev-dialogflow)[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)[telegramsdk/botapi

SDK for the Telegram Bot API.

234.0k1](/packages/telegramsdk-botapi)

PHPackages © 2026

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