symfony/ai-decart-platform
Symfony AI bridge for the Decart Platform. Connect to Decart’s APIs and models like Lucy through a Symfony-friendly integration, with links to platform documentation and contribution/issue resources in the main Symfony AI repository.
symfony/ai) via Composer, making this a low-friction fit for Laravel applications already using Symfony’s ecosystem (e.g., HTTP clients, caching, or messaging).Provider abstraction enables multi-provider support, allowing Laravel to switch between Decart and other AI services (e.g., OpenAI, Mistral) without refactoring core logic. This is critical for future-proofing and vendor diversification..env for API keys) mitigates this by centralizing external dependencies..env files, with optional encryption (e.g., laravel-env-encrypt) for sensitive credentials. Laravel’s config caching ensures zero overhead in production.Cache facade.spatie/queue-scheduler) can manage bursty traffic.
composer require symfony/ai symfony/ai-decart-platform.AiClient and Decart’s Provider in Laravel’s container (e.g., AppServiceProvider).Decart::generate()) to abstract Symfony’s Client calls, improving developer ergonomics.HttpClient with Decart’s API (higher maintenance, no abstraction benefits).laravel-decart) if the Symfony bridge lacks features.Phase 1: Proof of Concept (1–2 weeks)
symfony/ai and symfony/ai-decart-platform..env with Decart credentials.telescope for request logging; laravel-debugbar for API response inspection.Phase 2: Core Integration (2–3 weeks)
App\Services\DecartAIService) to wrap Symfony’s AiClient.spatie/laravel-queue-retries).monolog) for API calls, errors, and costs.namespace App\Services;
use Symfony\Component\AI\Client\AiClient;
use Symfony\Component\AI\Client\AiModel;
class DecartAIService {
public function __construct(private AiClient $client) {}
public function generate(string $prompt): string {
$model = $this->client->getModel('lucy');
return $model->chat($prompt)->getContent();
}
}
AppServiceProvider:
$this->app->bind(DecartAIService::class, function ($app) {
return new DecartAIService(new AiClient());
});
Phase 3: Scaling and Optimization (Ongoing)
Cache facade.
$response = Cache::remember("decart_embedding_{$query}", now()->addHours(1), function () use ($query) {
return $this->generateEmbedding($query);
});
laravel-horizon).
DecartAIJob::dispatch($prompt)->onQueue('decart');
throttle middleware or spatie/rate-limiter to manage API calls.laravel-prometheus or datadog.make:provider to manually bind services if auto-wiring fails.DecartApiVersion enum and route requests dynamically.guzzlehttp/guzzle vs. Symfony’s HttpClient).
composer why-not to detect conflicts early..env:
DECART_API_KEY=your_key
DECART_API_URL=https://platform.decart.ai/api
composer require symfony/ai symfony/ai-decart-platform spatie/lar
How can I help you explore Laravel packages today?