PHPackages                             elliottlawson/converse-prism - 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. elliottlawson/converse-prism

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

elliottlawson/converse-prism
============================

Seamless integration between Laravel Converse and Prism PHP for AI conversations

v0.2.1(10mo ago)0246[1 issues](https://github.com/elliottlawson/converse-prism/issues)[1 PRs](https://github.com/elliottlawson/converse-prism/pulls)MITPHPPHP ^8.2CI passing

Since Jun 13Pushed 10mo agoCompare

[ Source](https://github.com/elliottlawson/converse-prism)[ Packagist](https://packagist.org/packages/elliottlawson/converse-prism)[ RSS](/packages/elliottlawson-converse-prism/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (9)Versions (11)Used By (0)

 [![Converse Prism Logo](converse-icon.png)](converse-icon.png)

 [![Tests](https://github.com/elliottlawson/converse-prism/workflows/Tests/badge.svg)](https://github.com/elliottlawson/converse-prism/actions) [![Latest Stable Version](https://camo.githubusercontent.com/6dd8e7fbfd73905916f6590e225ea54e79349bb7256ba0b2bfa531614ae95479/68747470733a2f2f706f7365722e707567782e6f72672f656c6c696f74746c6177736f6e2f636f6e76657273652d707269736d2f76)](https://packagist.org/packages/elliottlawson/converse-prism) [![Total Downloads](https://camo.githubusercontent.com/9ed60e1c564590bc186901c8ea7f520aa0044a4191e61bdb9412f6167edcc458/68747470733a2f2f706f7365722e707567782e6f72672f656c6c696f74746c6177736f6e2f636f6e76657273652d707269736d2f646f776e6c6f616473)](https://packagist.org/packages/elliottlawson/converse-prism) [![License](https://camo.githubusercontent.com/70396359fe5af4284b9f4b34851ecfc2e2b5b859c051c5ea4e91d9cdd10f5717/68747470733a2f2f706f7365722e707567782e6f72672f656c6c696f74746c6177736f6e2f636f6e76657273652d707269736d2f6c6963656e7365)](https://packagist.org/packages/elliottlawson/converse-prism)

Converse Prism - Seamless AI Integration for Laravel Converse
=============================================================

[](#converse-prism---seamless-ai-integration-for-laravel-converse)

**Managing conversation context is hard. Managing AI provider APIs is harder. Doing both is a nightmare.**

Converse Prism bridges [Laravel Converse](https://github.com/elliottlawson/converse) with [Prism PHP](https://github.com/echolabsdev/prism) to make AI conversations effortless. Write `$conversation->toPrismText()` and your entire conversation history flows to any AI provider—OpenAI, Anthropic, Google, or beyond. No manual message formatting. No provider lock-in. Just conversations that work.

📚 Documentation
---------------

[](#-documentation)

**[View the full documentation](https://converse-prism.netlify.app)** - Comprehensive guides, API reference, and examples.

The Magic
---------

[](#the-magic)

Without Converse Prism, you're juggling two complex systems:

```
// Extract messages from Converse 😓
$messages = [];
foreach ($conversation->messages as $message) {
    $messages[] = [
        'role' => $message->role,
        'content' => $message->content
    ];
}

// Manually configure Prism
$prism = Prism::text()
    ->using(Provider::OpenAI, 'gpt-4')
    ->withMessages($messages)
    ->withMaxTokens(500);

// Make the call
$response = $prism->generate();

// Figure out metadata storage...
$conversation->messages()->create([
    'role' => 'assistant',
    'content' => $response->text,
    // What about tokens? Model info? 🤷
]);
```

With Converse Prism, it's seamless:

```
// Everything flows automatically ✨
$response = $conversation
    ->toPrismText()
    ->using(Provider::OpenAI, 'gpt-4')
    ->withMaxTokens(500)
    ->asText();

// Store response with all metadata
$conversation->addPrismResponse($response->text);
```

That's it. **Your conversation history becomes your AI context. Automatically.**

Features
--------

[](#features)

- 🔄 **Automatic Message Passing** - Conversation history flows to AI providers without manual formatting
- 🎯 **Direct Prism Integration** - First-class support for all Prism features and providers
- 🌊 **Elegant Streaming** - Real-time responses with automatic chunk collection and storage
- 🛠️ **Tool &amp; Function Support** - Handle complex AI workflows with automatic message type management
- 📊 **Complete Metadata** - Token counts, model info, and response metadata stored automatically
- 🚀 **Drop-in Enhancement** - Works with all existing Converse code, just adds Prism superpowers

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

[](#installation)

```
composer require elliottlawson/converse-prism
```

The Prism package will be installed automatically. Run the migrations:

```
php artisan migrate
```

Quick Start
-----------

[](#quick-start)

Update your User model to use the Converse Prism trait:

```
use ElliottLawson\ConversePrism\Concerns\HasAIConversations;

class User extends Authenticatable
{
    use HasAIConversations; // Replaces the base Converse trait
}
```

Start having AI conversations:

```
use Prism\Enums\Provider;

// Build the conversation context
$conversation = $user->startConversation(['title' => 'My Chat'])
    ->addSystemMessage('You are a helpful assistant')
    ->addUserMessage('Hello! What is Laravel?');

// Make your AI call with automatic message passing
$response = $conversation
    ->toPrismText()
    ->using(Provider::OpenAI, 'gpt-4')
    ->withMaxTokens(500)
    ->asText();

// Store the AI's response with metadata
$conversation->addPrismResponse($response->text);
```

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11.0+
- Converse ^1.0
- Prism ^0.6

License
-------

[](#license)

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

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance54

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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

Total

7

Last Release

307d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6254cce9312896ac7e2d54852a67745f163aef7284adc749222dbff0f06c37f2?d=identicon)[elliottlawson](/maintainers/elliottlawson)

---

Top Contributors

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

---

Tags

aiconversational-ailaravelllmlaravelaiopenaiprismllmanthropicconversations

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/elliottlawson-converse-prism/health.svg)

```
[![Health](https://phpackages.com/badges/elliottlawson-converse-prism/health.svg)](https://phpackages.com/packages/elliottlawson-converse-prism)
```

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[soukicz/llm

LLM client with support for cache, tools and async requests

445.6k](/packages/soukicz-llm)

PHPackages © 2026

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