Download the PHP package ikarolaborda/azure-openai-sdk-php without Composer

On this page you can find all versions of the php package ikarolaborda/azure-openai-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package azure-openai-sdk-php

Azure OpenAI SDK for PHP

A PHP package that brings first-class Azure OpenAI Service support to your applications. Built on top of openai-php/client — the excellent community-maintained PHP client created by Nuno Maduro and contributors.

This package handles Azure-specific deployment-based URL routing, API versioning, and authentication (API keys and Azure AD / Entra ID) so you can work with Azure OpenAI the same way you work with the standard OpenAI API.

Table of Contents

Installation

Requires PHP 8.2+

If your project doesn't already have a PSR-18 HTTP client, install one:

Configuration

Laravel

The package auto-discovers its service provider and facade. Publish the config file:

This creates config/azure-openai.php. Then add your credentials to .env:

Now you can use the facade anywhere in your application:

Or resolve the client from the container:

Standalone (non-Laravel)

Without Laravel, configure the client directly. Set your environment variables and call client() with no arguments:

Or pass parameters explicitly — any argument takes precedence over its environment variable:

For full control, use the factory:

If you prefer using the resource name instead of the full endpoint URL:

Usage

Because Azure routes requests based on the deployment name in the URL, you don't need to pass a model parameter in your calls — it's determined by the deployment you configured.

Chat Completions

Responses API

The Responses API is OpenAI's newest interface for generating model outputs. It works the same way as the Python client.responses.create():

With tools (web search, file search, or custom functions):

Streamed responses:

Streaming

Embeddings

Multiple Deployments

Each client targets a single deployment. If your application uses multiple models, create a client for each:

Account-Scoped Operations

Some Azure OpenAI operations — like listing models or managing files — don't require a deployment. You can omit the deployment for these:

Authentication

API Key

The most common method. Your key is sent via the api-key header:

Azure AD / Entra ID Token

For production workloads, Azure AD tokens are recommended over API keys:

Azure AD Token Provider

For long-running processes where tokens expire, pass a callable that fetches a fresh token on each request:

API Versions

Azure OpenAI requires an explicit API version on every request. The package provides an enum with known versions:

Enum Case Value
V2024_06_01 2024-06-01
V2024_10_21 2024-10-21
V2025_01_01_PREVIEW 2025-01-01-preview
V2025_03_01_PREVIEW 2025-03-01-preview

Available Resources

This package gives you access to all resources provided by openai-php/client, routed through Azure's deployment-based endpoints. Deployment-scoped resources (chat, completions, embeddings, images, audio, responses) are automatically routed via /deployments/{deployment}/. Account-scoped resources (models, files, fine-tuning, assistants, threads, batches, vector stores, moderations) are routed directly under /openai/.

For full resource documentation, see the openai-php/client README.


Built with care by Ikaro C. Laborda. Licensed under the MIT license.


All versions of azure-openai-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^11.0|^12.0|^13.0
openai-php/client Version ^0.19
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ikarolaborda/azure-openai-sdk-php contains the following files

Loading the files please wait ...