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 Platform

Ai Platform Laravel Package

symfony/ai-platform

Experimental Symfony component offering an abstraction layer for AI models and their providers. It defines common contracts and interfaces, while separate bridge packages add support for platforms like Anthropic, OpenAI, Gemini, Ollama, and Mistral. Install with composer require symfony/ai-platform.

View on GitHub
Deep Wiki
Context7

Symfony AI Platform provides a clean abstraction for interacting with AI models, their providers and contracts, decoupling your application from any single vendor. Install the core component, then pull in the bridge package matching your provider—Anthropic, OpenAI, Google Gemini, Mistral, Ollama and dozens more—to switch platforms without rewriting your code.

  • Unified model and provider contracts across all bridges
  • Pluggable architecture with dedicated platform bridges per vendor
  • Built-in Cache and Failover bridges for resilience and speed
  • Experimental component aligned with Symfony conventions
Frequently asked questions about Ai Platform
How do I install symfony/ai-platform in a Laravel app?
Install the core package with composer require symfony/ai-platform, then add at least one provider bridge such as symfony/ai-openai-platform, symfony/ai-anthropic-platform, or symfony/ai-ollama-platform. In Laravel, bind Symfony\AI\Platform\PlatformInterface in a service provider or resolve it from the container, and configure the bridge credentials. Because the component is experimental, pin versions in composer.json and review release notes before upgrading.
Does symfony/ai-platform work with Laravel?
Yes. It is a framework-agnostic PHP package, and Laravel's service container, HTTP client, queues, and events can integrate with it cleanly. You typically bind PlatformInterface as a singleton or context-bound service and inject the appropriate bridge. It is not a Laravel package with auto-discovered service providers, so you wire the platform and bridge configuration yourself.
How do I switch AI providers without changing business logic in Laravel?
Use the Platform abstraction and inject PlatformInterface rather than calling provider SDKs directly. Install the bridge packages you need and change the bridge or platform configuration in your Laravel service provider. This lets you swap providers such as OpenAI, Mistral, Anthropic, or Ollama without rewriting business logic, and the failover bridge can help degrade gracefully.
Which AI providers does symfony/ai-platform support?
Support comes through bridge packages, including Anthropic, Azure OpenAI, AWS Bedrock, Cohere, Google Gemini, Ollama, Mistral, DeepSeek, Hugging Face, LM Studio, and others. You install the core symfony/ai-platform package plus the bridge for each provider you use. For unsupported or internal APIs, the generic bridge or a custom bridge can be used.
Is symfony/ai-platform safe for production Laravel applications?
Treat it as experimental: Symfony states that experimental components are not covered by its backward compatibility promise, so breaking changes can occur. For production, pin exact or narrow versions, monitor release notes, and test upgrades carefully. Add failover or cache bridges where appropriate and benchmark against direct provider SDKs for latency-sensitive workloads.
How do I configure API keys and HTTP client settings for AI bridges in Laravel?
Store provider API keys in environment variables and Laravel config, then pass them into the bridge or its HTTP client configuration. Laravel's HTTP client can wrap Symfony's HTTP client where you need auth headers, retries, or scoped settings. The exact bridge configuration varies, so check each bridge package's options and avoid hardcoding credentials.
Can symfony/ai-platform handle streaming, tool calling, and structured outputs in Laravel?
The component is designed around standardized contracts for advanced AI features, including streaming, tool calling, agents, multimodal inputs, and structured outputs. Symfony's ecosystem provides streaming interfaces and serialization support that can integrate with Laravel responses and queues. Verify that your chosen provider bridge supports the specific feature you need, since bridge coverage may vary.
How do I test Laravel code that uses symfony/ai-platform?
Bind a fake or stub implementation of PlatformInterface in Laravel's container so tests do not call live AI providers. You can also use cache, failover, or generic bridges to create deterministic test scenarios, and assert the prompts or responses your application produces. Keep live API integration tests separate and run them sparingly with dedicated credentials.
What are alternatives to symfony/ai-platform for Laravel AI integration?
Alternatives include direct provider SDKs such as the OpenAI PHP SDK or Anthropic SDK, Laravel-specific AI wrappers, or custom HTTP client code against provider APIs. Symfony AI Platform is strongest when you need a multi-provider abstraction and alignment with Symfony components. For a single provider and a simple use case, a direct SDK may be less complex.
How do I add a custom or unsupported AI provider to symfony/ai-platform?
Implement the platform bridge contracts for your provider or extend the generic platform bridge for internal APIs. Register that bridge with the Platform instance in your Laravel service provider, then inject PlatformInterface as usual. Because the component is experimental, review the current contracts before building and monitor upgrades for breaking changes.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console