orhanerday/open-ai
A popular PHP SDK for OpenAI's API, orhanerday/open-ai offers simple methods for ChatGPT, GPT-4, DALL-E, Whisper, embeddings, and moderation. Framework-agnostic with Laravel support, streaming, and easy Composer installation.
Architecture fit
orhanerday/open-ai is a thin, fluent wrapper over OpenAI's REST surface (Orhanerday\OpenAi\OpenAi with chat(), complete(), embedding(), image(), audio(), file(), streaming via callback). It is framework-agnostic and PSR-4 autoloaded, so it drops into Laravel cleanly, but it is not Laravel-native: no service provider, no config publishing, no facade, no Http client integration.LlmClient interface) with this package as one adapter. That single decision converts a vendor-risk question into a swap-out exercise later.Integration feasibility
Http::fake() does not intercept it. You must abstract at your own interface boundary and fake that, or stand up a local stub server. This is a design constraint to accept up front, not a detail.Technical risk
Key questions
Stack fit
app/Services/Llm/ with an OpenAiAdapter implementing an LlmClient contract; bind in a LlmServiceProvider; publish config/llm.php for key, base URL, model defaults, timeout, retry policy, and per-feature token caps.Migration path
LlmClient contract and adapter. Nothing outside the adapter imports Orhanerday\*. Enforce with a static-analysis rule.openai-php/client or a direct Http::withToken() implementation. Consumer code does not change.Compatibility
composer.json and commit the lockfile. Treat upgrades as deliberate, tested changes, not composer update collateral.X-Accel-Buffering: no or a queue+websocket approach).Sequencing
Maintenance
Support
Scaling
Failure modes
.env, logs, or exception traces. Use a secrets manager, redact at the decorator, and rotate on a schedule.Ramp-up
How can I help you explore Laravel packages today?