PHPackages                             tallesairan/oobapi-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. tallesairan/oobapi-php

ActiveLibrary[API Development](/categories/api)

tallesairan/oobapi-php
======================

PHP Wrapper for oobabooga's text-generation-webui

1.2(2y ago)020PHPPHP &gt;=7.4

Since Jul 27Pushed 2y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (4)Used By (0)

oobapi-php Documentation
========================

[](#oobapi-php-documentation)

### PHP Wrapper for oobabooga's text-generation-webui

[](#php-wrapper-for-oobaboogas-text-generation-webui)

This is a PHP client for interacting with WebSocket and HTTP endpoints of the Text Generation API. The client allows you to send requests to the server and receive responses from the WebSocket and HTTP endpoints.

This documentation provides information about the `oobapi-php` library, a PHP wrapper for oobabooga's text-generation-webui. The library consists of two main classes, `ApiClient` and `StreamClient`, each responsible for interacting with different API endpoints.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [ApiClient](#apiclient)
    - [Constructor](#constructor)
    - [Methods](#methods)
        - [generate](#generate)
        - [chat](#chat)
        - [stopStream](#stopstream)
- [StreamClient](#streamclient)
    - [Constructor](#constructor-1)
    - [Methods](#methods-1)
        - [stream](#stream)
        - [chatStream](#chatstream)

Installation
------------

[](#installation)

To use the `oobapi-php` library, you need to have PHP 7.4 or later installed. Additionally, the library depends on the following packages:

- `guzzlehttp/guzzle` version 7.0 or later
- `textalk/websocket` version 1.6.1 or later

You can install the library via Composer. Add the following to your `composer.json` file and run `composer install`:

### Requirements

[](#requirements)

- PHP 7.4 or higher
- Composer

```
composer require tallesairan/oobapi-php
```

ApiClient
---------

[](#apiclient)

The `ApiClient` class allows you to interact with the oobabooga's text-generation-webui API using HTTP requests.

### Constructor

[](#constructor)

Create a new `ApiClient` instance by providing the base URL for the API:

```
use Airan\OobApi\ApiClient;

$baseUrl = 'http://example.com'; // Replace with your API base URL
$apiClient = new ApiClient($baseUrl);
```

### Methods

[](#methods)

#### generate

[](#generate)

Generate text based on a given prompt and optional parameters.

```
/**
* Generate text based on a given prompt and optional parameters.
*
* @param string $prompt The input prompt for text generation.
* @param array $params Optional parameters to customize text generation.
* @return array An array containing the generated text and additional data.
  */
  public function generate($prompt, $params = []) {
  // Implementation details...
  }
```

#### chat

[](#chat)

Chat with the API to generate interactive text based on user input and history.

```
/**
* Chat with the API to generate interactive text based on user input and history.
*
* @param string $userInput The user's input text.
* @param string $history The conversation history.
* @param array $params Optional parameters to customize the chat.
* @return array An array containing the generated response and additional data.
  */
  public function chat($userInput, $history, $params = []) {
  // Implementation details...
  }
```

#### stopStream

[](#stopstream)

Stop the text generation stream.

```
/**
* Stop the text generation stream.
*
* @return array An array containing the response data.
  */
  public function stopStream() {
  // Implementation details...
  }
```

StreamClient
------------

[](#streamclient)

- Take careful this is under development

The `StreamClient` class enables you to interact with the oobabooga's text-generation-webui API using WebSocket.

### Constructor

[](#constructor-1)

Create a new `StreamClient` instance by providing the WebSocket base URL:

```
use Airan\OobApi\StreamClient;

$webSocketBaseUrl = 'ws://example.com'; // Replace with your WebSocket base URL
$streamClient = new StreamClient($webSocketBaseUrl);
```

### Methods

[](#methods-1)

#### stream

[](#stream)

Generate text using WebSocket streaming based on a given prompt and optional parameters.

```
/**
* Generate text using WebSocket streaming based on a given prompt and optional parameters.
*
* @param string $prompt The input prompt for text generation.
* @param array $params Optional parameters to customize text generation.
* @return array An array containing the generated text and additional data.
  */
  public function stream($prompt, $params = []) {
  // Implementation details...
  }
```

#### chatStream

[](#chatstream)

Chat using WebSocket streaming to generate interactive text based on user input and history.

```
/**
* Chat using WebSocket streaming to generate interactive text based on user input and history.
*
* @param string $userInput The user's input text.
* @param string $history The conversation history.
* @param array $params Optional parameters to customize the chat.
* @return array An array containing the generated response and additional data.
  */
  public function chatStream($userInput, $history, $params = []) {
  // Implementation details...
  }
```

Please note that the above documentation provides a general overview of the `oobapi-php` library and its main classes. For more specific implementation details and usage examples, refer to the source code and documentation of the library itself.

### Contributions

[](#contributions)

Contributions are welcome! If you find any issues or want to improve the client, feel free to open a pull request.

### License

[](#license)

This project is licensed under the MIT License. See the LICENSE file for details.

Please make sure to adjust the WebSocket and HTTP endpoint URLs in the Usage section to match the actual implementation of your WebSocket and HTTP servers. Also, update the WebSocket and HTTP server information in the WebSocket Server and HTTP Server sections accordingly.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1026d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/71bc67c217f09cac05a1355dd791c88694732a81d30be15b9a8b726446d9ed6d?d=identicon)[tallesairan](/maintainers/tallesairan)

---

Top Contributors

[![tallesairan](https://avatars.githubusercontent.com/u/2424128?v=4)](https://github.com/tallesairan "tallesairan (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tallesairan-oobapi-php/health.svg)

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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