← all repositories
openai-php/client

Community-built PHP SDK wraps OpenAI's whole API

A typed PHP client for the entire OpenAI API, streaming included, so you can skip the cURL choreography.

5.8k stars PHP Language Models
client
Not currently ranked — collecting fresh signals.
star history

What it does

OpenAI PHP is a community-maintained SDK that wraps the OpenAI REST API for PHP 8.2+ projects. It maps the full API surface—chat, embeddings, images, audio, fine-tuning, vector stores, and the newer Responses endpoint—into typed PHP objects you can read by property or dump to an array. Think of it as a translation layer that turns OpenAI’s JSON into something idiomatic for Laravel, Symfony, or plain PHP codebases.

The interesting bit

The library doesn’t just chase the latest endpoints; it also carries deprecated resources like Assistants, Threads, and the old FineTunes API, which is either convenient baggage or archaeological preservation depending on your migration status. The factory builder is unusually flexible, letting you inject custom PSR-18 HTTP clients, swap base URIs for Azure proxies, and attach your own stream handlers without subclassing.

Key highlights

  • Covers the full API: models, chat, embeddings, images, audio, vector stores, batches, and the new Responses API
  • Streaming support via server-sent events for real-time generation
  • Typed response objects with both property access and a toArray() escape hatch
  • Configurable factory supports custom HTTP clients, headers, query params, and alternative base URIs
  • Maintains deprecated endpoints (Assistants, Threads, FineTunes, Edits) alongside current ones

Verdict

PHP developers who want a structured, native way to call OpenAI without managing raw HTTP payloads. Everyone else already has their language’s official client.

Frequently asked

What is openai-php/client?
A typed PHP client for the entire OpenAI API, streaming included, so you can skip the cURL choreography.
Is client open source?
Yes — openai-php/client is open source, released under the MIT license.
What language is client written in?
openai-php/client is primarily written in PHP.
How popular is client?
openai-php/client has 5.8k stars on GitHub.
Where can I find client?
openai-php/client is on GitHub at https://github.com/openai-php/client.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.