Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Ai Chat Laravel Package

symfony/ai-chat

Symfony AI Chat is a lightweight package for building chat-style AI features in Symfony apps. It provides simple abstractions to connect to LLM providers, manage messages and context, and integrate conversational workflows with clean, framework-friendly APIs.

View on GitHub
Deep Wiki
Context7

PHP library for building chats with agents.

Frequently asked questions about Ai Chat
What is symfony/ai-chat used for?
Symfony AI Chat is a PHP library for building chat-style AI features on top of the Symfony AI Agent component. It lets you create chats, submit messages to agents, and manage conversation messages and context through simple abstractions. It is framework-friendly but not tied to a full application stack, so it can be wired into Laravel's container and routing. Typical uses include support bots, internal assistant tools, and conversational interfaces backed by an LLM provider.
How do I install symfony/ai-chat in a Laravel application?
Install it with Composer using composer require symfony/ai-chat. If you want to persist conversation history, also install the bridge package for your chosen store, such as symfony/ai-doctrine-message-store, symfony/ai-redis-message-store, or symfony/ai-cache-message-store. Then bind agents and message stores in a service provider and expose a chat endpoint through a Laravel route or controller.
Does symfony/ai-chat work with Laravel even though it is Symfony-native?
Yes, it can be integrated with Laravel because the underlying components follow PSR standards such as PSR-11 and PSR-15, which Laravel's container and HTTP layers can work with. You register agents and tools as Laravel bindings, call the chat service from controllers or jobs, and use Laravel middleware for auth and throttling. Some glue code or the Symfony bridge may be needed, so plan for a small integration layer rather than a drop-in Laravel package.
Which Laravel and PHP versions are supported by symfony/ai-chat?
The package is part of the Symfony AI initiative and targets modern PHP, with Laravel 10.x and newer commonly cited as a practical baseline for integration. Because it is experimental, version constraints can shift between releases, so check the composer.json requirements of symfony/ai-chat and the related agent and bridge packages before upgrading. Pin versions in production and test upgrades in staging.
How do I store and persist chat history with symfony/ai-chat?
Chat history is handled through message store bridges, and the package ships separate bridge packages for Cache, Doctrine, Redis, Session, MongoDB, Meilisearch, Cloudflare, Pogocache, and SurrealDB. In a Laravel app you would typically choose Redis or the database-backed Doctrine store, or write a custom store around Laravel's cache or Eloquent if you prefer. Keep in mind that long conversations can grow quickly, so define retention and trimming rules for production.
How do I connect symfony/ai-chat to OpenAI, Anthropic, or another LLM provider?
Symfony AI Chat sits on top of the Agent component, which handles the connection to LLM providers, so provider configuration happens at the agent or platform layer rather than inside the chat component itself. You configure the agent with the appropriate provider credentials and model, then create chats and submit messages through the chat API. For Laravel, store API keys in the environment and resolve the configured agent through the service container.
Is symfony/ai-chat stable enough for production use?
The component is explicitly marked experimental, which means it is not covered by Symfony's backward compatibility promise and its APIs may change between releases. It can still be used in production, but you should pin exact versions, wrap the chat layer behind your own interfaces, and keep upgrade tests in place. Treat it as a fast-moving building block rather than a fixed long-term contract.
How can I run long-running agent tasks asynchronously with Laravel queues?
Because the package is Symfony-native, asynchronous workflows are typically handled through symfony/messenger, which can be adapted to Laravel's queue system or run alongside it. A common pattern is to dispatch a job that resolves the agent, submits the message, and stores the result in the message store, then notify the front end when it completes. Add retries with backoff and log provider timeouts so failed agent runs are recoverable.
How do I test chat features built with symfony/ai-chat?
There is no dedicated Laravel testing helper documented for this experimental package, so the practical approach is to mock or fake the agent and message store dependencies you bind in the container. Test your controller and job logic against a stub agent that returns predictable messages, and keep separate integration tests for real provider calls. This keeps most of your test suite fast and avoids spending tokens in CI.
How does symfony/ai-chat compare to other PHP AI chat libraries, and who maintains it?
It is maintained as part of the Symfony AI project, a read-only sub-tree split of the main symfony/ai repository where issues and pull requests are handled. Compared with standalone Laravel AI packages, it offers tighter alignment with Symfony components like HttpClient and Messenger while remaining usable in Laravel through PSR interfaces and manual wiring. The trade-off is that it is experimental and less Laravel-specific, so evaluate it against your need for framework-native conventions and long-term API stability.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels