symfony/ai-generic-platform
A generic platform bridge for Symfony AI that connects the framework's AI components to a common platform abstraction, simplifying configuration and enabling interoperable model integrations within Symfony applications.
AiClientInterface), which Laravel apps can consume as a standalone Composer dependency. v0.14.0 does not alter this contract, so the architectural posture is unchanged.model property on TokenUsage (#1566) enables per-model cost calculation, which is the missing primitive for spend attribution and quota enforcement.TokenUsage::model, Laravel code can now persist usage per model and drive billing, per-tenant quotas, or budget alerts from a single table. Previously this required capturing the model name out-of-band.0.x. Under Composer semantics, ^0.14 permits only 0.14.* patches — minor releases like this one can carry breaking changes by convention. This release happens not to, but the upgrade policy must be explicit (pin exact versions or gate minor bumps behind a test run).AiClientInterface, exception translation into Laravel's handler, and Messenger-vs-queue divergence remain the same integration tax.model property, cost overruns were only detectable via provider dashboards. Now they're detectable in-app, which lowers the risk of unnoticed spend.TokenUsage::model as the system of record for AI spend, and where does that data live (per-tenant table, billing pipeline)?0.14.* exactly, and who owns reviewing each 0.x minor for breaking changes?spatie/ai or direct HTTP client calls been evaluated? (Unchanged.)symfony/ai-generic-platform:0.14.* plus symfony/http-client; do not introduce the Symfony framework.AiClientInterface in a Laravel service provider, selecting OpenAI, Eden AI, or another gateway via config.TokenUsage (model, prompt/completion tokens) to a table or event stream. This is the natural place to enforce per-tenant quotas and emit cost metrics.TokenUsage.composer.json constraints against the app's PHP and Laravel versions; the release does not signal a PHP floor change, but confirm before bumping.composer require symfony/ai-generic-platform:0.14.* symfony/http-client
AppServiceProvider) — add a gateway selector so Eden AI can be configured without code changes:
$this->app->bind(\Symfony\Component\Ai\AiClientInterface::class, function ($app) {
return match (config('services.ai.gateway')) {
'eden' => new \Symfony\Component\Ai\Client\EdenAiClient(config('services.ai.eden.key')),
default => new \Symfony\Component\Ai\Client\OpenAiClient(config('services.ai.openai.key')),
};
});
TokenUsage (including the new model property) after each call.0.x means every minor bump needs review. Set a policy — pin 0.14.*, review each minor in a branch, and require a green test suite before merge. This release is a good template for a low-risk bump.report() path; keep the try/catch wrapper.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Symfony 0.x minor breaking change | App fails to boot after a routine bump | Pin 0.14.*; review each minor in a branch before merge |
| AI provider API outage | Feature degradation | Eden AI or a second gateway as fallback; graceful degradation |
| Gateway hop latency/outage (Eden AI) | Slower or failed AI calls | Benchmark against direct provider; keep direct path as fallback |
| Messenger transport failure | Async AI tasks fail silently | Laravel queue listeners with retries and alerting |
| Rate limiting by provider | Throttled requests | Laravel middleware for rate limiting; per-tenant quotas from usage data |
| Silent cost overrun | Budget surprise | Alert on TokenUsage model/token aggregates; enforce quotas |
| PHP memory limits | Large responses crash worker | queue:work --memory and response size caps |
How can I help you explore Laravel packages today?