PHPackages                             logipro/chatbot-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. logipro/chatbot-php

ActiveApp[API Development](/categories/api)

logipro/chatbot-php
===================

Client PHP for Chatbot API

v0.0.2(4mo ago)0279↓50%MITPHPPHP ^7.4 || &gt;=8.0

Since Nov 3Pushed 4mo agoCompare

[ Source](https://github.com/logipro-fr/chatbot-php)[ Packagist](https://packagist.org/packages/logipro/chatbot-php)[ Docs](https://github.com/frederic100/chatbot-php)[ RSS](/packages/logipro-chatbot-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (10)Versions (6)Used By (0)

Chatbot PHP
===========

[](#chatbot-php)

Client PHP for Chatbot API

Install
-------

[](#install)

```
composer require logipro-fr/chatbot-php
```

Ou pour installer depuis le dépôt :

```
git clone https://github.com/logipro-fr/chatbot-php
cd chatbot-php
./install --profile devlocal
```

Usage
-----

[](#usage)

### 1. Initialisation

[](#1-initialisation)

Créez un client en spécifiant l'URL de l'API :

```
use ChatbotPhp\Chatbot;

$client = Chatbot::client('http://api.example.com');
```

Ou utilisez l'URL par défaut :

```
$client = Chatbot::client();
```

### 2. Créer un contexte

[](#2-créer-un-contexte)

Un contexte contient les instructions ou le contexte que l'assistant utilisera :

```
$context = json_decode($client->contexts()->create([
    'context_message' => 'Vous êtes un assistant expert en documentation PHP.'
]), true);
$contextId = $context['data']['contextId'];
```

### 3. Uploader un fichier

[](#3-uploader-un-fichier)

Ajoutez des fichiers que l'assistant pourra utiliser :

```
$file = json_decode($client->files()->upload([
    'file_path' => '/path/to/documentation.pdf',
    'purpose' => 'assistants'
]), true);
$fileId = $file['data']['file_id'];
```

### 4. Créer un assistant

[](#4-créer-un-assistant)

Créez un assistant basé sur un contexte et des fichiers :

```
$assistant = json_decode($client->assistants()->create([
    'context_id' => $contextId,
    'file_ids' => [$fileId]
]), true);
$assistantId = $assistant['data']['assistantId'];
```

### 5. Créer un thread (conversation avec assistant)

[](#5-créer-un-thread-conversation-avec-assistant)

Démarrez une conversation avec votre assistant :

```
$thread = json_decode($client->threads()->create([
    'ast_id' => $assistantId,
    'message' => 'Peux-tu m\'aider à documenter cette fonction PHP ?'
]), true);
$conversationId = $thread['data']['conversationId'];
$assistantMessage = $thread['data']['assistantMessage'];
echo $assistantMessage;
```

### 6. Continuer la conversation

[](#6-continuer-la-conversation)

Envoyez des messages supplémentaires dans le thread :

```
$response = json_decode($client->threads()->continue([
    'conversation_id' => $conversationId,
    'message' => 'Peux-tu m\'expliquer plus en détail ?'
]), true);
$responseMessage = $response['data']['message'];
echo $responseMessage;
```

### Ressources disponibles

[](#ressources-disponibles)

#### Contexts - Gestion des contextes

[](#contexts---gestion-des-contextes)

```
$client->contexts()->create(['context_message' => '...']);
$client->contexts()->retrieve($contextId);
$client->contexts()->update(['id' => '...', 'new_message' => '...']);
$client->contexts()->delete($contextId);
```

#### Files - Gestion des fichiers

[](#files---gestion-des-fichiers)

```
$client->files()->upload(['file_path' => '...', 'purpose' => 'assistants']);
$client->files()->list();
$client->files()->retrieve($fileId);
$client->files()->delete($fileId);
```

#### Assistants - Gestion des assistants

[](#assistants---gestion-des-assistants)

```
$client->assistants()->create(['context_id' => '...', 'file_ids' => [...]]);
$client->assistants()->retrieve($assistantId);
$client->assistants()->update(['assistant_id' => '...', 'file_ids' => [...]]);
$client->assistants()->delete($assistantId);
```

#### Conversations - Gestion des conversations simples

[](#conversations---gestion-des-conversations-simples)

```
$client->conversations()->create(['prompt' => '...', 'lm_name' => '...', 'context' => '...']);
$client->conversations()->continue(['prompt' => '...', 'conv_id' => '...', 'lm_name' => '...']);
$client->conversations()->retrieve($conversationId);
$client->conversations()->list($assistantId);
```

#### Threads - Gestion des threads (conversations avec assistant)

[](#threads---gestion-des-threads-conversations-avec-assistant)

```
$client->threads()->create(['ast_id' => '...', 'message' => '...']);
$client->threads()->continue(['conversation_id' => '...', 'message' => '...']);
```

Contributing
------------

[](#contributing)

### Requirements

[](#requirements)

- docker
- git

### Add a .env.local file

[](#add-a-envlocal-file)

To install locally or on a development server, be careful with the following environment variables:

- DATA\_PATH: path where data is stored; must be inside the project (default: ./data)
- DATA\_PATH\_STORE: path for backups; generally outside the project (default: ../data/chatbot-php)
- REMOVE\_DATABASE\_WHEN\_INSTALL: remove database during install (default: false)
- BUILD\_WHEN\_INSTALL: build application during install (default: false)
- DOCKER\_DEV: run development-specific containers (default: false)
- DOCKER\_PHP\_BUILT\_IMAGE: application prebuilt Docker image
- OPTIONAL\_VOLUME: mount a local volume for localhost development (default: empty)
- LOCALDEV\_WORKING\_DIR: working directory useful for development (default: undefined)
- URL\_API: override the base URL used by internal API clients (default: empty)
- PULL\_POLICY: policy for pulling the PHP built image on start (default: missing)

Typical local development .env.local:

```
DATA_PATH=./data
REMOVE_DATABASE_WHEN_INSTALL=true
BUILD_WHEN_INSTALL=true
DOCKER_DEV=true
OPTIONAL_VOLUME=.:/var/chatbot-php
LOCALDEV_WORKING_DIR=true
URL_API=http://nginx
PULL_POLICY=never

```

Typical server development .env.local:

```
DATA_PATH=../data
REMOVE_DATABASE_WHEN_INSTALL=true
DOCKER_DEV=true
DOCKER_PHP_BUILT_IMAGE=
URL_API=https://dev.your-app.tld

```

For production and pre-production, a .env.local MUST NOT exist because default variables target the production environment. However, this project includes a frontend that calls the API, so in pre-production you need a .env.local to override `URL_API`.

Typical pre-production .env.local:

```
URL_API=https://preprod.your-app.tld

```

Tests
-----

[](#tests)

### Unit tests

[](#unit-tests)

```
bin/phpunit
```

We use Test-Driven Development (TDD) principles and good practices.

### Integration tests

[](#integration-tests)

Integration tests are all test categories other than unit tests.

```
bin/integration
```

### Acceptance tests

[](#acceptance-tests)

Acceptance tests are integration tests that verify the application against feature specifications. Gherkin is the specification language; Behat is the PHP runner.

```
bin/behat
```

Manual tests
------------

[](#manual-tests)

```
./start
```

Then open 172.17.0.1:35080/ in your browser.

```
./stop
```

Quality
-------

[](#quality)

Some indicators we aim for:

- phpcs PSR12
- phpstan level 10
- coverage &gt;=100%
- infection MSI &gt;=100%

Quick check:

```
./codecheck
```

Check coverage:

```
bin/phpunit --coverage-html var
```

Then open `var/index.html` in your browser.

Check infection:

```
bin/infection
```

Then open `var/infection.html` in your browser.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance77

Regular maintenance activity

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 56.5% 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 ~23 days

Total

4

Last Release

126d ago

PHP version history (2 changes)v0.0.1-alphaPHP 7.4.\*

v0.0.1-beta.1PHP ^7.4 || &gt;=8.0

### Community

Maintainers

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

---

Top Contributors

[![MarioPereira43](https://avatars.githubusercontent.com/u/148750151?v=4)](https://github.com/MarioPereira43 "MarioPereira43 (13 commits)")[![EddyLogipro](https://avatars.githubusercontent.com/u/245829174?v=4)](https://github.com/EddyLogipro "EddyLogipro (9 commits)")[![frederic100](https://avatars.githubusercontent.com/u/50176793?v=4)](https://github.com/frederic100 "frederic100 (1 commits)")

---

Tags

phpDDT

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/logipro-chatbot-php/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[deepseek-php/deepseek-php-client

deepseek PHP client is a robust and community-driven PHP client library for seamless integration with the Deepseek API, offering efficient access to advanced AI and data processing capabilities.

47073.9k5](/packages/deepseek-php-deepseek-php-client)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

9230.2k4](/packages/bitrix24-b24phpsdk)[ezsystems/allure-php-api

PHP API for Allure adapter

13431.1k11](/packages/ezsystems-allure-php-api)[mjaschen/collmex

Collmex PHP SDK

2080.7k](/packages/mjaschen-collmex)[afiqiqmal/malaysiaholiday

to get all holidays date in malaysia

329.0k](/packages/afiqiqmal-malaysiaholiday)

PHPackages © 2026

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