PHPackages                             maximerenou/hugging-chat - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. maximerenou/hugging-chat

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

maximerenou/hugging-chat
========================

HuggingChat client

v0.5.2(3y ago)18902[1 PRs](https://github.com/maximerenou/php-hugging-chat/pulls)PHPPHP &gt;=7.1

Since Apr 26Pushed 3y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

[![HuggingChat + PHP](logo.png)](logo.png)

HuggingChat client
==================

[](#huggingchat-client)

[![License](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](https://opensource.org/licenses/MIT)[![Latest Stable Version](https://camo.githubusercontent.com/ab3f2f2d41dbff7e798730859d5651fbdcab8ee473c6b23da222002536d852c3/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6d6178696d6572656e6f752f7068702d68756767696e672d63686174)](https://packagist.org/packages/maximerenou/hugging-chat)[![PHP version](https://camo.githubusercontent.com/ce952217cdd3169fb6d83aa15df7e4bc366206de16682b5f8f018754049bfab3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6d6178696d6572656e6f752f68756767696e672d636861742f706870)](https://packagist.org/packages/maximerenou/hugging-chat)[![cURL extension required](https://camo.githubusercontent.com/3b7a2ac9e7758e56b3c13782336baf3ea3b13242a9ea254785303d9c6522aa1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6d6178696d6572656e6f752f68756767696e672d636861742f6578742d6375726c)](https://packagist.org/packages/maximerenou/hugging-chat)

This is an unofficial PHP client for **HuggingChat** (OpenAssistant's LLaMA model).

> HuggingChat API [is evolving fast](https://huggingface.co/spaces/huggingchat/chat-ui/commits/main) with recurring breaking changes. I try to keep up with it, but it may not always work as expected. Feel free to open an issue if you encounter any problem.

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

[](#installation)

```
composer require maximerenou/hugging-chat

```

Demo
----

[](#demo)

Run `examples/chat.php` to test it.

[![Prompt Demo](examples/demo.gif)](examples/demo.gif)

Usage
-----

[](#usage)

```
use MaximeRenou\HuggingChat\Client as HuggingChat;
use MaximeRenou\HuggingChat\Prompt;

$ai = new HuggingChat();

$conversation = $ai->createConversation();

// $answer - full answer
$answer = $conversation->ask(new Prompt("Hello World"));
```

 Real-time / progressive answerYou may pass a function as second argument to get real-time progression:

```
// $current_answer - incomplete answer
// $tokens - last tokens received
$final_answer = $conversation->ask($prompt, function ($current_answer, $tokens) {
    echo $tokens;
});
```

  Resume a conversationIf you want to resume a previous conversation, you can retrieve its identifiers:

```
// Get current identifiers
$identifiers = $conversation->getIdentifiers();

// ...
// Resume conversation with $identifiers parameter
$conversation = $ai->resumeConversation($identifiers);
```

  Use another modelYou can use a specific model:

```
$conversation = $ai->createConversation("bigcode/starcoder");
```

Default is OpenAssistant.

  Generate a conversation's summaryUseful to give a title to a conversation.

```
// Question asked: "Who's Einstein?"
// ...
$summary = $conversation->getSummary();
// Result: Famous genius mathematician.
```

  Turn on/off data sharingHuggingChat share your conversations to improve the model. You can turn on/off data sharing:

```
$conversation->enableSharing(); // on

$conversation->disableSharing(); // off (module default)
```

 Delete a conversation```
$conversation->delete();
```

 Handle HuggingChat errorsThe code throws exceptions when it receives an error from HuggingChat. You can therefore use a try/catch block to handle errors.

 Answers are sometimes malformed (or dumb)Answers quality depends on the model you're using.

---

#### Disclaimer

[](#disclaimer)

Using HuggingChat outside huggingface.co/chat may violate HuggingFace terms. Use it at your own risk.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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 ~1 days

Total

7

Last Release

1100d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/80bcf6ed37c089e47d02a7210fefb2ecd4ebc38c05491f72c0ef2a55fb0536f0?d=identicon)[maximerenou](/maintainers/maximerenou)

---

Top Contributors

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

---

Tags

aichatbothuggingchathuggingfacellamaopenassistant

### Embed Badge

![Health badge](/badges/maximerenou-hugging-chat/health.svg)

```
[![Health](https://phpackages.com/badges/maximerenou-hugging-chat/health.svg)](https://phpackages.com/packages/maximerenou-hugging-chat)
```

###  Alternatives

[razonyang/yii2-rate-limiter

Yii2 Rate Limiter

1025.0k1](/packages/razonyang-yii2-rate-limiter)

PHPackages © 2026

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