PHPackages                             massrimcp/openai-sdk - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. massrimcp/openai-sdk

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

massrimcp/openai-sdk
====================

Open Ai SDK

0.1.1(3mo ago)23MITPHPCI failing

Since Jan 30Pushed 3mo agoCompare

[ Source](https://github.com/mohammed-almassri/openai-sdk)[ Packagist](https://packagist.org/packages/massrimcp/openai-sdk)[ RSS](/packages/massrimcp-openai-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (5)Used By (0)

PHP SDK for OpenAI API
======================

[](#php-sdk-for-openai-api)

A modern PHP SDK for interacting with the OpenAI API, including support for Chat, Completions, and more. Built for PHP 8+ with a focus on developer experience, type safety, and extensibility.

Features
--------

[](#features)

- Simple and intuitive API for OpenAI endpoints
- Support for Chat, Completions, and other OpenAI features
- DTOs for request/response payloads
- Extensible and testable client architecture
- PSR-7/PSR-18 compatible HTTP client support

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

[](#installation)

Install via Composer:

```
composer require your-vendor/php-sdk
```

Usage
-----

[](#usage)

```
use YourVendor\OpenAiSdk\OpenAiSdk;

$client = new OpenAiClient('your-api-key');

$response = $client->chat()->create([
    'model' => 'gpt-4',
    'messages' => [
        ['role' => 'user', 'content' => 'Hello!'],
    ],
]);

print_r($response);
```

### Chat API Example

[](#chat-api-example)

```
$chatClient = $client->chat();
$result = $chatClient->create([
    'model' => 'gpt-4',
    'messages' => [
        ['role' => 'user', 'content' => 'Tell me a joke.'],
    ],
]);
echo $result['choices'][0]['message']['content'];
```

Testing
-------

[](#testing)

Run tests with PHPUnit:

```
vendor/bin/phpunit
```

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Composer
- PSR-7/PSR-18 compatible HTTP client (e.g., Guzzle)

Contributing
------------

[](#contributing)

Contributions are welcome! Please open issues or submit pull requests.

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

32

—

LowBetter than 71% of packages

Maintenance86

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity27

Early-stage or recently created project

 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

2

Last Release

99d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20cd46185ba935a0290e27f48983e5dfa64202b93e488bd3eefc1f42301a348d?d=identicon)[massrimcp](/maintainers/massrimcp)

---

Top Contributors

[![mohammed-almassri](https://avatars.githubusercontent.com/u/51961143?v=4)](https://github.com/mohammed-almassri "mohammed-almassri (18 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/massrimcp-openai-sdk/health.svg)

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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