- 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.