PHPackages                             fonclub/openai-laravel-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. [API Development](/categories/api)
4. /
5. fonclub/openai-laravel-client

ActiveLibrary[API Development](/categories/api)

fonclub/openai-laravel-client
=============================

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

0.3.5(3y ago)194MITPHPPHP ^8.1.0

Since Mar 14Pushed 3y agoCompare

[ Source](https://github.com/fonclub/openai-laravel-client)[ Packagist](https://packagist.org/packages/fonclub/openai-laravel-client)[ Fund](https://www.paypal.com/paypalme/enunomaduro)[ GitHub Sponsors](https://github.com/nunomaduro)[ RSS](/packages/fonclub-openai-laravel-client/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

 [![GitHub Workflow Status (master)](https://camo.githubusercontent.com/9b5cd89503ff72dcb851fc486957d3c4bd976569a67b9bb1ce306599c1cb6fdd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6f70656e61692d7068702f6c61726176656c2f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d726f756e642d737175617265)](https://github.com/openai-php/laravel/actions) [![Total Downloads](https://camo.githubusercontent.com/6a1c4ae8216497114ded6bd858a32b6aefaf8325523573ca2fc4460f165bd4f2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70656e61692d7068702f6c61726176656c)](https://packagist.org/packages/openai-php/laravel) [![Latest Version](https://camo.githubusercontent.com/e2809c4e8588860cffc1dc375ae9a90d8a3eb725dee58afaeb42ffd11ff9bc7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e61692d7068702f6c61726176656c)](https://packagist.org/packages/openai-php/laravel) [![License](https://camo.githubusercontent.com/a23c4458f94b4da93c4cc295173f74f0fea13a50262954fb99f8d91658ccae82/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6f70656e61692d7068702f6c61726176656c)](https://packagist.org/packages/openai-php/laravel)

---

**OpenAI PHP** for Laravel is a community-maintained PHP API client that allows you to interact with the [Open AI API](https://beta.openai.com/docs/api-reference/introduction). If you or your business relies on this package, it's important to support the developers who have contributed their time and effort to create and maintain this valuable tool:

- Nuno Maduro: **[github.com/sponsors/nunomaduro](https://github.com/sponsors/nunomaduro)**
- Sandro Gehri: **[github.com/sponsors/gehrisandro](https://github.com/sponsors/gehrisandro)**

> **Note:** This repository contains the integration code of the **OpenAI PHP** for Laravel. If you want to use the **OpenAI PHP** client in a framework-agnostic way, take a look at the [openai-php/client](https://github.com/openai-php/client) repository.

Get Started
-----------

[](#get-started)

> **Requires [PHP 8.1+](https://php.net/releases/)**

First, install OpenAI via the [Composer](https://getcomposer.org/) package manager:

```
composer require openai-php/laravel
```

Next, publish the configuration file:

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

This will create a `config/openai.php` configuration file in your project, which you can modify to your needs using environment variables:

```
OPENAI_API_KEY=sk-...
```

Finally, you may use the `OpenAI` facade to access the OpenAI API:

```
use OpenAI\Laravel\Facades\OpenAI;

$result = OpenAI::completions()->create([
    'model' => 'text-davinci-003',
    'prompt' => 'PHP is',
]);

echo $result['choices'][0]['text']; // an open-source, widely-used, server-side scripting language.
```

Usage
-----

[](#usage)

For usage examples, take a look at the [openai-php/client](https://github.com/openai-php/client) repository.

---

OpenAI PHP for Laravel is an open-sourced software licensed under the **[MIT license](https://opensource.org/licenses/MIT)**.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.5% 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

Unknown

Total

1

Last Release

1156d ago

### Community

Maintainers

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

---

Top Contributors

[![nunomaduro](https://avatars.githubusercontent.com/u/5457236?v=4)](https://github.com/nunomaduro "nunomaduro (31 commits)")[![fonclub](https://avatars.githubusercontent.com/u/6120785?v=4)](https://github.com/fonclub "fonclub (3 commits)")[![xenon87](https://avatars.githubusercontent.com/u/116573?v=4)](https://github.com/xenon87 "xenon87 (2 commits)")[![peterfox](https://avatars.githubusercontent.com/u/1716506?v=4)](https://github.com/peterfox "peterfox (1 commits)")[![krishnahimself](https://avatars.githubusercontent.com/u/19906424?v=4)](https://github.com/krishnahimself "krishnahimself (1 commits)")[![butschster](https://avatars.githubusercontent.com/u/773481?v=4)](https://github.com/butschster "butschster (1 commits)")[![askdkc](https://avatars.githubusercontent.com/u/7894265?v=4)](https://github.com/askdkc "askdkc (1 commits)")

---

Tags

phpapiclientlaravelsdklanguageprocessingnaturalcodexGPT-3openaidall-e

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/fonclub-openai-laravel-client/health.svg)](https://phpackages.com/packages/fonclub-openai-laravel-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)[openai-php/client

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

5.8k22.6M232](/packages/openai-php-client)[openai-php/symfony

Symfony Bundle for OpenAI

215715.5k3](/packages/openai-php-symfony)

PHPackages © 2026

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