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(5mo ago)33MITPHPCI failing

Since Jan 30Pushed 5mo 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 today

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

29

—

LowBetter than 57% of packages

Maintenance73

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

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

154d 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

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M45](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[oat-sa/tao-core

TAO core extension

66143.7k124](/packages/oat-sa-tao-core)

PHPackages © 2026

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