openai-php/client is a Composer package that exposes OpenAI REST resources for chat, responses, audio, images, vector stores, agents, and legacy endpoints in PHP 8.2+.
Overview
OpenAI PHP is a community-maintained PHP SDK for calling the OpenAI API from application code. It is installed via Composer and expects a PSR-18 HTTP client when your project does not already provide one.
The client surfaces resource-oriented methods matching OpenAI's API areas, including models, chat and responses, conversations, audio, embeddings, files, images, vector stores, batches, realtime helpers, agents-related endpoints, and deprecated assistant and thread APIs still documented for migration.
Configuration supports factory-style client creation, optional per-request headers through withHttpHeaders, Azure-specific setup, webhooks, and testing guidance in the shipped documentation. Usage examples show listing models and performing standard API calls from PHP applications.
Key features
- Composer-installable PHP 8.2+ SDK
- Resource classes for major OpenAI APIs
- Configurable HTTP client and headers
- Streaming and multipart upload support
- Azure OpenAI integration path
- Webhook helpers and testing notes
- Legacy endpoint coverage for migration
- PSR-18 compatible HTTP layer
Use cases
- Calling OpenAI chat or responses from PHP apps
- Server-side image or audio generation
- Managing vector stores and file uploads
- Integrating OpenAI into Laravel or Symfony services