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 Laravel Package

symfony/ai

Symfony AI provides PHP components and Symfony integration for building AI-powered applications. It includes abstractions for AI platforms, agents, tool calling, embeddings, vector stores, and RAG workflows, plus bridges to popular providers and a bundle for quick setup.

Deep Wiki
Context7

Symfony AI is a collection of PHP components for adding AI capabilities to Symfony and standalone PHP applications. It provides a unified abstraction over multiple AI platforms—OpenAI, Anthropic, Gemini, Ollama, and more—so you can switch providers without rewriting code, alongside tools for building agents, working with vector stores, and integrating the Model Context Protocol (MCP).

  • Unified platform abstraction across many LLM providers
  • Agent framework with tools and multi-step reasoning
  • Vector store integrations for embeddings and RAG
  • MCP client and server support
  • Framework-agnostic: works with or without Symfony
Frequently asked questions about Ai
Can I use symfony/ai in a Laravel app even though it's a Symfony package?
Yes. symfony/ai is a component suite rather than a monolith, and the pieces Laravel would consume are largely plain PHP built on PSR-18/PSR-17 HTTP, PSR-7 messages, and Symfony contracts, and Laravel's dependency graph already overlaps with much of that stack. The Symfony bundle is the part that assumes the Symfony DI container and configuration tree, so skip it. Treat the package as an SDK and wire the providers and agents you need yourself in a service provider.
How do I install symfony/ai in Laravel with Composer?
Install only the individual components you need rather than the bundle, then bind the platform and agent factories as container singletons in a service provider. Expect to pin exact versions, because Laravel's pinned ranges for symfony/http-client, symfony/event-dispatcher, and symfony/serializer may not intersect with a fast-moving 0.x package. Run composer why symfony/http-client to understand conflicts before upgrading, and keep AI configuration in config/ai.php instead of YAML.
Why should I avoid installing symfony/ai-bundle in Laravel?
The bundle assumes Symfony's DI container, configuration tree, and autoconfiguration tags, none of which map cleanly onto Laravel's container semantics. Trying to boot it inside Laravel produces brittle container gymnastics that are hard to explain to the next maintainer. Install the components only and construct providers, agents, and tools explicitly in your own service provider.
Does symfony/ai work with Laravel 11 and Laravel 12 on PHP 8.2?
It is compatible in principle, because Laravel 11 and 12 on PHP 8.2+ already ship a broad slice of symfony/* transitively. The realistic blockers are version collisions on shared packages such as symfony/http-client, symfony/event-dispatcher, and symfony/serializer. Test the install against your exact Laravel minor and pin versions until the AI package reaches 1.0.
How do I test Laravel code that calls symfony/ai without hitting real APIs?
Symfony's test doubles and profiler integration are bundle-oriented, so build your own fakes in Laravel instead. The cleanest approach is an AIFake-style driver swap that binds a deterministic fake platform or PSR-18 client in the container for the test suite. That keeps tests offline, fast, and free of token spend, and it also lets you assert on prompts and tool calls.
Is symfony/ai stable enough for production, or will 0.x releases break my app?
It is pre-1.0, so API churn risk is high: minor releases can break things, meaning you should pin exact versions and read changelogs before upgrading. The technical risk is concentrated in volatility rather than quality, and the architecture is sound under an MIT license. Ask the maintainers about their backward-compatibility policy between minors and any 1.0 timeline before committing.
How do I stream symfony/ai responses in Laravel under PHP-FPM or Octane?
The AI abstraction likely assumes long-lived request handling, so streaming in Laravel needs care. Under PHP-FPM, use server-sent events with output buffering disabled and flush after each chunk. Under Octane, watch for stateful agents and static provider clients leaking between requests: resolve agents per request and avoid holding mutable state on singletons.
How do I build a RAG pipeline with vector stores in Laravel using symfony/ai?
Put the package's store integrations behind an interface you own, and back it with Eloquent or pgvector depending on your scale. Confirm which store backends are first-class versus community-maintained before designing around one, and verify pgvector support specifically. Wire retrieval as an invokable tool so the agent can call it, and keep chunking and embedding work in Laravel queues.
Is tool calling with symfony/ai safe in production?
Tool calling means the model can invoke application code, so treat every tool argument as untrusted input. Allow-list which tools each agent may call, validate arguments with Laravel's validator, and run authorization checks before any side effect. Add your own max-iteration guard too, because provider abstractions differ and loop termination is not something you should assume.
Does symfony/ai handle token accounting, retries, and timeouts for me?
Not out of the box: token accounting, per-tenant budget enforcement, tracing, and per-call timeouts are things you will likely have to build yourself. The upside is that you can often inject a PSR-18 client behind Laravel's Http facade to get logging, retries, and fakes. Confirm whether the HTTP layer accepts an injected PSR-18 client and whether lifecycle hooks exist for cost and tracing before relying on them.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections