PHPackages                             kauffinger/livewire-chat-kit - 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. kauffinger/livewire-chat-kit

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

kauffinger/livewire-chat-kit
============================

A clean streamed chat kit for Laravel Livewire. Built with FluxUI &amp; Prism.

v2.0.1(3mo ago)501377[1 PRs](https://github.com/kauffinger/livewire-chat/pulls)MITPHPPHP ^8.2CI passing

Since May 22Pushed 3mo ago1 watchersCompare

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

READMEChangelog (8)Dependencies (19)Versions (12)Used By (0)

Livewire Chat Kit
=================

[](#livewire-chat-kit)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d724e3063f3e71e931a28184008cc95ccfe76911a41fa836561be43869f38b91/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61756666696e6765722f6c697665776972652d636861742d6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kauffinger/livewire-chat-kit)[![GitHub Tests Action Status](https://camo.githubusercontent.com/fe17b68ae5337808938285bb3c1296f920c1fce6d654755474ff72861feaba8f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b61756666696e6765722f6c697665776972652d636861742f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/kauffinger/livewire-chat/actions?query=workflow%3Atests+branch%3Amain)[![Linter Action Status](https://camo.githubusercontent.com/02ef01b67f0547169ba7127bdc0e77441b8fb8a33629e2d009b132b7f9e718cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b61756666696e6765722f6c697665776972652d636861742f6c696e742e796d6c3f6272616e63683d6d61696e266c6162656c3d6c696e746572267374796c653d666c61742d737175617265)](https://github.com/kauffinger/livewire-chat/actions?query=workflow%3Alint+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/bf99a8e16b0e881b871d85a9fd86362328dd555ab76d5eee7bd72cf560a9523b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61756666696e6765722f6c697665776972652d636861742d6b69742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kauffinger/livewire-chat-kit)

A Laravel Starter Kit for building LLM-powered chat interfaces with Livewire, [FluxUI](https://fluxui.com), and [Prism](https://github.com/prism-php/prism). Jump right into the LLM party without touching (much) JavaScript, while still having a good-looking and effortlessly feeling chat interface.

This starter kit provides a clean, simple foundation for creating chat applications. It's designed to get you sending your first chat messages to an LLM instantly.

Features
--------

[](#features)

### Chat System

[](#chat-system)

- **Multi-Chat Management:** Create, manage, and navigate between multiple chat conversations
- **Chat Sidebar:** Quick access to recent chats with intelligent navigation
- **Chat Sharing:** Share conversations publicly or keep them private with visibility controls
- **Model Selection:** Choose from different LLM models (GPT-4o, GPT-4o-mini, etc.) per chat
- **Persistent History:** All conversations are saved and accessible across sessions

### LLM Integration

[](#llm-integration)

- **Livewire-Powered:** Build dynamic interfaces with PHP.
- **Streamed Responses:** Real-time message streaming from LLMs for a smooth UX.
- **Prism Integration:** The Laravel-way of speaking to LLMs. Easy to use, test, and switch between providers (e.g., OpenAI, Anthropic).
- **Tool Support:** Built-in LLM tool calling with visual feedback and result display

### UI &amp; Design

[](#ui--design)

- **FluxUI Components:** Beautiful, pre-built UI components for a polished look and feel.
- **Minimal JavaScript:** Focus on your PHP backend.
- **TailwindCSS Styled:** Includes a TailwindCSS setup with a typography plugin for rendering markdown.
- **Real-time Updates:** Seamless UI updates using Livewire streams

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

[](#installation)

You can install this starter kit into a new Laravel application using Composer:

```
laravel new my-chat-app --using=kauffinger/livewire-chat-kit
```

After installation, make sure to:

1. Run migrations: `php artisan migrate`
2. Install NPM dependencies: `npm install`
3. Build assets: `npm run dev` (or `npm run build` for production)

Getting Started
---------------

[](#getting-started)

### 1. Configure LLM Provider

[](#1-configure-llm-provider)

This starter kit uses [Prism](https://github.com/prism-php/prism) to interact with LLMs. By default, it's configured to use OpenAI's `gpt-4o-mini`. You'll need to add your API key to your `.env` file.

```
OPENAI_API_KEY=your-openai-api-key
# OPENAI_ORGANIZATION_ID= (optional)
```

You can easily switch to other providers supported by Prism (like Anthropic) by modifying the `Chat.php` component. For example, to use Claude:

```
// In app/Livewire/Chat.php
// ...
use Prism\Prism\Enums\Provider;

// ...
    public function runChatToolLoop(): void
    {
        $generator = Prism::text()
            ->using(Provider::Anthropic, 'claude-3-opus-20240229') // Example for Claude
            // ->using(Provider::OpenAI, 'gpt-4o-mini') // Default
            ->withSystemPrompt('You are a helpful assistant.')
            ->withMessages(collect($this->messages)->map->toPrism()->all())
            ->asStream();
        // ...
    }
// ...
```

Remember to add the corresponding API key to your `.env` file (e.g., `ANTHROPIC_API_KEY`).

### 2. Explore the Chat Interface

[](#2-explore-the-chat-interface)

Navigate to your application's `/dashboard` route to start interacting with the chat interface. You can:

- Create new chats from the sidebar
- Switch between existing conversations
- Share chats publicly or keep them private
- Change the LLM model for each chat
- Use built-in tools (like the example sum calculator)

Architecture
------------

[](#architecture)

### Core Components

[](#core-components)

- **`app/Livewire/Chats/Index.php`** - Paginate over all of your chats
- **`app/Livewire/Chats/Show.php`** - Main chat component handling LLM streaming, tool calls, and message management
- **`app/Livewire/ChatSidebar.php`** - Chat navigation, history, and new chat creation
- **`app/Models/Chat.php`** - Chat model with user relationships and visibility controls
- **`app/Models/Message.php`** - Message model with tool call/result support and Prism integration

### Business Logic Layer

[](#business-logic-layer)

- **`app/Actions/`** - Clean action classes for complex operations:
    - `AddNewUserMessageToChat` - Handles user message persistence
    - `UpdateStreamDataFromPrismChunk` - Processes streaming LLM responses
    - `PersistStreamDataToMessages` - Saves complete responses to database
- **`app/Dtos/StreamData.php`** - Type-safe data transfer object for streaming
- **`app/Policies/ChatPolicy.php`** - Authorization rules for chat access and sharing

### UI Components

[](#ui-components)

- **Chat Interface:** Real-time streaming with markdown rendering
- **Tool Results Display:** Visual feedback for LLM tool executions
- **Model Selector:** Per-chat model configuration
- **Sharing Controls:** Public/private visibility management
- **Toast Notifications:** Built-in toast system for user feedback

How it Works
------------

[](#how-it-works)

### Message Flow

[](#message-flow)

1. **User Input:** Message typed in chat interface and submitted
2. **Message Processing:** `AddNewUserMessageToChat` action persists user message
3. **LLM Streaming:** `runChatToolLoop()` initiates real-time streaming with Prism
4. **Stream Handling:** `UpdateStreamDataFromPrismChunk` processes each chunk (text, tool calls, results)
5. **UI Updates:** Livewire streams update the interface in real-time
6. **Persistence:** `PersistStreamDataToMessages` saves complete conversation

### Tool Integration

[](#tool-integration)

- **Tool Definitions:** Tools are defined in the `runChatToolLoop()` method
- **Automatic Execution:** LLM can call tools during conversation flow
- **Visual Feedback:** Tool calls and results are displayed with dedicated UI components

### Technical Implementation

[](#technical-implementation)

- **UUID Models:** All models use UUIDs for security and scalability
- **Policy Authorization:** Fine-grained access control with `ChatPolicy`
- **Type Safety:** DTOs and strong typing throughout the application
- **Testing:** Comprehensive Pest test suite with Livewire integration
- **Code Quality:** Laravel Pint, Rector, and Prettier for consistent formatting

Toast Notifications
-------------------

[](#toast-notifications)

The chat kit includes a built-in toast notification system for user feedback.

### Basic Setup

[](#basic-setup)

Add the toast container to your layout (e.g., in `resources/views/layouts/app.blade.php`):

```

```

### Usage in Livewire Components

[](#usage-in-livewire-components)

```
// In your Livewire component - using named parameters
$this->dispatch('toast',
    variant: 'success',
    title: 'Success!',
    description: 'Your changes have been saved.',
    icon: 'check-circle',
    duration: 3000
);
```

### Usage with Alpine.js

[](#usage-with-alpinejs)

```

  Show Success Toast

```

### Toast Options

[](#toast-options)

- `variant`: 'default' | 'success' | 'error' | 'danger' | 'warning' | 'info'
- `title`: The main message
- `description`: Additional details (optional)
- `icon`: Icon name (optional, auto-set based on variant)
- `dismissible`: Whether the toast can be dismissed (default: true)
- `duration`: Auto-dismiss after milliseconds (default: 5000, use 0 to disable)

### Container Positions

[](#container-positions)

- `position`: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' (default: 'bottom-right')

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

[](#contributing)

Contributions are welcome! If you'd like to improve the Livewire Chat Kit, please feel free to:

- Report a bug.
- Suggest a new feature.
- Submit a pull request.

Please visit the [GitHub repository](https://github.com/kauffinger/livewire-chat-kit) to contribute.

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance87

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

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

Recently: every ~55 days

Total

8

Last Release

94d ago

Major Versions

v0.0.1 → v1.0.02025-06-26

v1.1.1 → v2.0.02026-02-03

### Community

Maintainers

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

---

Top Contributors

[![kauffinger](https://avatars.githubusercontent.com/u/62616071?v=4)](https://github.com/kauffinger "kauffinger (66 commits)")[![benatoff](https://avatars.githubusercontent.com/u/146389211?v=4)](https://github.com/benatoff "benatoff (2 commits)")

---

Tags

laravellivewirestarterkitlaravellivewireprismchatllmsfluxui

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kauffinger-livewire-chat-kit/health.svg)

```
[![Health](https://phpackages.com/badges/kauffinger-livewire-chat-kit/health.svg)](https://phpackages.com/packages/kauffinger-livewire-chat-kit)
```

###  Alternatives

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)[marcorieser/statamic-livewire

A Laravel Livewire integration for Statamic.

2381.5k10](/packages/marcorieser-statamic-livewire)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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