PHPackages                             fixik/openai-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. fixik/openai-client

ActiveLibrary

fixik/openai-client
===================

A PHP client for the OpenAI API with chat, embeddings, images, fine-tuning, Laravel support

v1.0.0(4mo ago)110MITPHPPHP &gt;=8.1CI passing

Since Dec 11Pushed 4mo agoCompare

[ Source](https://github.com/OlegMarko/openai-client)[ Packagist](https://packagist.org/packages/fixik/openai-client)[ RSS](/packages/fixik-openai-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (8)Used By (0)

OpenAI PHP Client
=================

[](#openai-php-client)

[![CI](https://github.com/OlegMarko/openai-client/actions/workflows/ci.yml/badge.svg)](https://github.com/OlegMarko/openai-client/actions/workflows/ci.yml/badge.svg)[![Packagist Version](https://camo.githubusercontent.com/0b22151e9bfbbeed2f9bddc018a58cfeadcc075821441dde68f01af8367040ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666978696b2f6f70656e61692d636c69656e74)](https://camo.githubusercontent.com/0b22151e9bfbbeed2f9bddc018a58cfeadcc075821441dde68f01af8367040ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666978696b2f6f70656e61692d636c69656e74)[![Total Downloads](https://camo.githubusercontent.com/1277905f09a10bcbf317fc1b8377ddade86b4225528ee01db320f912cb48119b/68747470733a2f2f706f7365722e707567782e6f72672f666978696b2f6f70656e61692d636c69656e742f646f776e6c6f616473)](https://camo.githubusercontent.com/1277905f09a10bcbf317fc1b8377ddade86b4225528ee01db320f912cb48119b/68747470733a2f2f706f7365722e707567782e6f72672f666978696b2f6f70656e61692d636c69656e742f646f776e6c6f616473)[![Coverage](https://camo.githubusercontent.com/421911cd8be0b23e6811e51b46f962a9b672667ee4d77cfda0f8384c8ccb5a5f/68747470733a2f2f636f6465636f762e696f2f67682f4f6c65674d61726b6f2f6f70656e61692d636c69656e742f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://camo.githubusercontent.com/421911cd8be0b23e6811e51b46f962a9b672667ee4d77cfda0f8384c8ccb5a5f/68747470733a2f2f636f6465636f762e696f2f67682f4f6c65674d61726b6f2f6f70656e61692d636c69656e742f6272616e63682f6d61696e2f67726170682f62616467652e737667)[![License](https://camo.githubusercontent.com/532962b9c28c7e8f1874bf4fbf34ce6fcc00bd4a8cb062f0f3c8810257cd22bf/68747470733a2f2f706f7365722e707567782e6f72672f666978696b2f6f70656e61692d636c69656e742f6c6963656e7365)](https://camo.githubusercontent.com/532962b9c28c7e8f1874bf4fbf34ce6fcc00bd4a8cb062f0f3c8810257cd22bf/68747470733a2f2f706f7365722e707567782e6f72672f666978696b2f6f70656e61692d636c69656e742f6c6963656e7365)

A powerful PHP client for the OpenAI API with support for:

- Chat
- Embeddings
- Images
- Fine-tuning

Installation
------------

[](#installation)

```
composer require fixik/openai-client
```

Publish config (Laravel):
-------------------------

[](#publish-config-laravel)

```
php artisan vendor:publish --provider="Fixik\OpenAI\Laravel\OpenAIServiceProvider"
```

Add to .env:
------------

[](#add-to-env)

```
OPENAI_API_KEY=your_key
```

Usage Example PHP
-----------------

[](#usage-example-php)

```
use Fixik\OpenAI\OpenAIClient;

$apiKey = 'YOUR_OPENAI_API_KEY_HERE';

$openaiClient = new OpenAIClient($apiKey);

$message = "Write a haiku about modern PHP development.";

$openaiClient->chat()->send('gpt-3.5-turbo', $message);
$openaiClient->embeddings()->create('gpt-3.5-turbo', $message);
$openaiClient->fineTune()->create([
    'model' => 'gpt-3.5-turbo',
    'training_file' => 'file-id',
]);
$openaiClient->fineTune()->retrieve($jobId);
$openaiClient->images()->generate($message);
```

Usage Example Laravel
---------------------

[](#usage-example-laravel)

```
$message = "Write a haiku about modern PHP development.";

OpenAI::chat()->send('gpt-3.5-turbo', $message);
OpenAI::embeddings()->create('gpt-3.5-turbo', $message);
OpenAI::fineTune()->create([
    'model' => 'gpt-3.5-turbo',
    'training_file' => 'file-id',
]);
OpenAI::fineTune()->retrieve($jobId);
OpenAI::images()->generate($message);
```

Testing
-------

[](#testing)

### Run Pest:

[](#run-pest)

```
./vendor/bin/pest
```

Static Analyzers
----------------

[](#static-analyzers)

### Run PHPStan:

[](#run-phpstan)

```
./vendor/bin/phpstan analyse src --level=max
```

### Run Psalm:

[](#run-psalm)

```
./vendor/bin/psalm --no-cache
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance74

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

7

Last Release

149d ago

Major Versions

v0.0.6 → v1.0.02025-12-12

### Community

Maintainers

![](https://www.gravatar.com/avatar/b7dd29d3e343278840f94e063b56c8bbb8c4936433a5709db6658dd2efeba702?d=identicon)[OlegMarko](/maintainers/OlegMarko)

---

Top Contributors

[![OlegMarko](https://avatars.githubusercontent.com/u/17251450?v=4)](https://github.com/OlegMarko "OlegMarko (16 commits)")

---

Tags

phplaravelopenaiChatGpt

###  Code Quality

TestsPest

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fixik-openai-client/health.svg)

```
[![Health](https://phpackages.com/badges/fixik-openai-client/health.svg)](https://phpackages.com/packages/fixik-openai-client)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[stevebauman/location

Retrieve a user's location by their IP Address

1.3k7.6M65](/packages/stevebauman-location)[josiasmontag/laravel-recaptchav3

Recaptcha V3 for Laravel package

2641.6M2](/packages/josiasmontag-laravel-recaptchav3)[rajentrivedi/tokenizer-x

TokenizerX calculates required tokens for given prompt

91214.0k3](/packages/rajentrivedi-tokenizer-x)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
