openai-php/client
⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
What it solves
It provides a community-maintained PHP API client that allows developers to integrate OpenAI's services into their PHP applications without having to write raw HTTP requests to the OpenAI API.
How it works
The library acts as a wrapper around the OpenAI API, providing a structured PHP interface to interact with various resources. It uses a factory pattern to configure the client (API keys, organization, base URI) and leverages PSR-18 HTTP clients (like Guzzle) to handle the actual network communication. It supports both standard synchronous responses and server-sent events for streaming outputs.
Who it’s for
PHP developers who want to build AI-powered applications using OpenAI's models and tools.
Highlights
- Comprehensive Resource Support: Covers a wide range of OpenAI API endpoints including Chat, Audio, Embeddings, Images, Fine-Tuning, and Vector Stores.
- Streaming Support: Ability to create and retrieve responses using
createStreamedandretrieveStreamedfor real-time output. - Tool Integration: Built-in support for function calling and tools like web search and file search.
- Flexible Configuration: Allows customization of the HTTP client, base URI, and custom headers/query parameters.
- Azure Compatibility: Includes support for Azure OpenAI services.
Related
- Project
- Project
- Project
- Project
- Project