PHPackages                             halilcosdu-modification/laravel-chatbot - 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. halilcosdu-modification/laravel-chatbot

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

halilcosdu-modification/laravel-chatbot
=======================================

Laravel AI Chatbot Package

01[5 PRs](https://github.com/Youthis321/laravel-chatbot-modification/pulls)PHPCI passing

Since Sep 16Pushed 1mo agoCompare

[ Source](https://github.com/Youthis321/laravel-chatbot-modification)[ Packagist](https://packagist.org/packages/halilcosdu-modification/laravel-chatbot)[ RSS](/packages/halilcosdu-modification-laravel-chatbot/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (0)

Laravel AI Chatbot Package (GROQ Modified)
==========================================

[](#laravel-ai-chatbot-package-groq-modified)

[![Latest Version on Packagist](https://camo.githubusercontent.com/58919d3a371ccac681b8499c523f83ee7230f2e66965867f7a51307ff7b8b273/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f68616c696c636f7364752d6d6f64696669636174696f6e2f6c61726176656c2d63686174626f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/halilcosdu-modification/laravel-chatbot)[![GitHub Tests Action Status](https://camo.githubusercontent.com/acc339b5854962cda60f017a1d23646d8530203366f997e30b560249acdb464c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616c696c636f7364752f6c61726176656c2d63686174626f742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/halilcosdu/laravel-chatbot/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/5bd53126f899e9c0a8d15f8c1c292cab6dcfc8a11a602438fe57cd1544e0b0aa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616c696c636f7364752f6c61726176656c2d63686174626f742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/halilcosdu/laravel-chatbot/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f1b728778236367d6ece301e5aa77e79a2476559fb3810b61574b101b7a15f0c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f68616c696c636f7364752f6c61726176656c2d63686174626f742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/halilcosdu/laravel-chatbot)

Laravel Chatbot provides a robust and easy-to-use solution for integrating AI chatbots into your Laravel applications. Leveraging the power of OpenAI, it allows you to create, manage, and interact with chat threads directly from your Laravel application. Whether you're building a customer service chatbot or an interactive AI assistant, `laravel-chatbot` offers a streamlined, Laravel-friendly interface to the OpenAI API.

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

[](#installation)

You can install the package via composer:

```
composer require halilcosdu-modification/laravel-chatbot
```

You can publish the config file with:

```
php artisan vendor:publish --tag="chatbot-config"
```

This is the contents of the published config file:

You have to create an assistant on OpenAI and get the API key and assistant ID.

```
return [
    'assistant_id' => env('OPENAI_API_ASSISTANT_ID'),
    'api_key' => env('OPENAI_API_KEY'),
    'organization' => env('OPENAI_ORGANIZATION'),
    'request_timeout' => env('OPENAI_TIMEOUT'),
    'sleep_seconds' => env('OPENAI_SLEEP_SECONDS'), // Sleep seconds between requests default .1
    'models' => [
        // Thread model must have threadMessages(): HasMany relation
        // ThreadMessage model mush have thread(): BelongsTo relation
        'thread' => \HalilCosdu\ChatBot\Models\Thread::class,
        'thread_messages' => \HalilCosdu\ChatBot\Models\ThreadMessage::class
    ],
];
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="chatbot-migrations"
php artisan migrate
```

This will migrate the following tables:

```
Schema::create('threads', function (Blueprint $table) {
    $table->id();
    $table->string('owner_id')->nullable()->index();
    $table->string('subject');
    $table->string('remote_thread_id')->index();

    $table->timestamps();
});
```

```
Schema::create('thread_messages', function (Blueprint $table) {
    $table->id();
    $table->foreignIdFor(config('chatbot.models.thread'))->constrained()->cascadeOnDelete();
    $table->string('role')->index();
    $table->longText('content');

    $table->timestamps();
});
```

Usage
-----

[](#usage)

```
public function listThreads(mixed $ownerId = null, mixed $search = null, mixed $appends = null): \Illuminate\Contracts\Pagination\LengthAwarePaginator
public function createThread(string $subject, mixed $ownerId = null): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder
public function thread(int $id, mixed $ownerId = null): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder
public function updateThread(string $message, int $id, mixed $ownerId = null): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder
public function deleteThread(int $id, mixed $ownerId = null): void
```

```
ChatBot::listThreads(): LengthAwarePaginator; /* List all threads */
ChatBot::createThread('Hello, what is the capital of Turkey?'): Model; /* Create a new thread */
ChatBot::thread($id): Model; /* Get a thread with messages */
ChatBot::updateThread('Where should I visit?', $id): Model; /* Continue the conversation */
ChatBot::deleteThread($id): void; /* Delete the thread */
```

### Raw Data - Not Saved to Database

[](#raw-data---not-saved-to-database)

#### You can use the following methods to interact with the OpenAI API directly.

[](#you-can-use-the-following-methods-to-interact-with-the-openai-api-directly)

```
public function createThreadAsRaw(string $subject)
public function listThreadMessagesAsRaw(string $remoteThreadId)
public function updateThreadAsRaw(string $remoteThreadId, array $data) /* $data = ['role' => 'user or assistant', 'content' => 'Hello'] */
public function deleteThreadAsRaw(string $remoteThreadId)
public function threadAsRaw(string $threadId)
public function messageAsRaw(string $threadId, string $messageId)
public function modifyMessageAsRaw(string $threadId, string $messageId, array $parameters)
```

```
ChatBot::createThreadAsRaw(string $subject);
ChatBot::listThreadMessagesAsRaw(string $remoteThreadId);
ChatBot::updateThreadAsRaw(string $remoteThreadId, array $data);
ChatBot::deleteThreadAsRaw(string $remoteThreadId);
ChatBot::threadAsRaw(string $threadId);
ChatBot::messageAsRaw(string $threadId, string $messageId);
ChatBot::modifyMessageAsRaw(string $threadId, string $messageId, array $parameters);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Halil Cosdu](https://github.com/halilcosdu)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance61

Regular maintenance activity

Popularity1

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity19

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![halilcosdu](https://avatars.githubusercontent.com/u/6373017?v=4)](https://github.com/halilcosdu "halilcosdu (42 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (20 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (17 commits)")[![rashidlaasri](https://avatars.githubusercontent.com/u/36804104?v=4)](https://github.com/rashidlaasri "rashidlaasri (2 commits)")[![Youthis321](https://avatars.githubusercontent.com/u/33147280?v=4)](https://github.com/Youthis321 "Youthis321 (2 commits)")[![gracieuxsikuly](https://avatars.githubusercontent.com/u/80897404?v=4)](https://github.com/gracieuxsikuly "gracieuxsikuly (1 commits)")

### Embed Badge

![Health badge](/badges/halilcosdu-modification-laravel-chatbot/health.svg)

```
[![Health](https://phpackages.com/badges/halilcosdu-modification-laravel-chatbot/health.svg)](https://phpackages.com/packages/halilcosdu-modification-laravel-chatbot)
```

PHPackages © 2026

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