PHPackages                             marxolity/open-ai - 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. marxolity/open-ai

ActiveLibrary[API Development](/categories/api)

marxolity/open-ai
=================

OpenAI API

1.2.2(2y ago)785MITPHP

Since Nov 19Pushed 2y ago2 watchersCompare

[ Source](https://github.com/marcelooblan2016/open-ai)[ Packagist](https://packagist.org/packages/marxolity/open-ai)[ RSS](/packages/marxolity-open-ai/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (3)Versions (10)Used By (0)

OpenAI API Integration - Laravel
================================

[](#openai-api-integration---laravel)

[![uptime](https://camo.githubusercontent.com/38aed2222076687323534599884e57a714c9eb265d86af697e778b11a45efe10/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f757074696d652d3130302532352d627269676874677265656e)](https://camo.githubusercontent.com/38aed2222076687323534599884e57a714c9eb265d86af697e778b11a45efe10/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f757074696d652d3130302532352d627269676874677265656e) [![License](https://camo.githubusercontent.com/151319799e1f55fc43399737a4b9a556055e4355f3722cced12453d13b5bac1b/687474703a2f2f706f7365722e707567782e6f72672f6d6172786f6c6974792f6f70656e2d61692f6c6963656e7365)](https://packagist.org/packages/marxolity/open-ai) [![Total Downloads](https://camo.githubusercontent.com/298c21f2f4ce72f09b499afd83ea7bd5fea1e100943cc963d2df2cd782d88efa/687474703a2f2f706f7365722e707567782e6f72672f6d6172786f6c6974792f6f70656e2d61692f646f776e6c6f616473)](https://packagist.org/packages/marxolity/open-ai/)

---

A Laravel Package that facilitates effortless integration of the OpenAI API into PHP applications, ensuring seamless connectivity and interaction with OpenAI's services within the Laravel Framework.

---

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

[](#installation)

Install the package via Composer [Reference](https://packagist.org/packages/marxolity/open-ai):

```
composer require marxolity/open-ai
```

---

Configuration
-------------

[](#configuration)

Publish the package configuration: (config/open-ai.php)

```
php artisan vendor:publish --provider="Marxolity\OpenAi\OpenAIServiceProvider" --tag="config"
```

Set up your environment variables:

```
OPENAI_API_KEY=""
```

---

Usage
-----

[](#usage)

```
   use \Marxolity\OpenAi\Facades\OpenAi;
```

Changing Model then Retrieve responseMessage (Ex: Change model to `gpt-4`)

```
   $responseMessage = OpenAi::query("What is Laravel?")
        ->setModel('gpt-4')
        ->send()->responseMessage;
```

Retrieve Response Message

```
   $responseMessage = OpenAi::query("What is Laravel?")->send()->responseMessage;
```

Response Message:

```
   Laravel is a free, open-source PHP web framework used for developing web applications. It fol...
```

### Format Output

[](#format-output)

Retrieve as Array

```
   $responseArray = OpenAi::query("What is Laravel?")->send()->toArray();
```

Retrieve as JSON

```
   $responseJson = OpenAi::query("What is Laravel?")->send()->toJson();
```

Retrieve as XML

```
   $responseXml = OpenAi::query("What is Laravel?")->send()->toXml();
```

### Tested Models (Limited to `GPT Models`)

[](#tested-models-limited-to-gpt-models)

ModelNoteDate`gpt-3.5-turbo-1106`Nov 22, 2023`gpt-3.5-turbo-16k`Nov 22, 2023`gpt-3.5-turbo`**`default`**Nov 20, 2023`gpt-3.5-turbo-1106`Nov 20, 2023`gpt-4`The account must reach at minimum **Tier 1** status.Nov 20, 2023`gpt-4-vision-preview`The account must reach at minimum **Tier 1** status.Nov 20, 2023`gpt-4-0613`The account must reach at minimum **Tier 1** status.Nov 22, 2023`gpt-4-1106-preview`The account must reach at minimum **Tier 1** status.Nov 22, 2023> Note: Please be advised that other GPT models may be utilized at your discretion, acknowledging associated risks.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community8

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

6

Last Release

908d ago

### Community

Maintainers

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

---

Top Contributors

[![marcelooblan2016](https://avatars.githubusercontent.com/u/36547331?v=4)](https://github.com/marcelooblan2016 "marcelooblan2016 (48 commits)")

---

Tags

aigpt-3gpt-4laravellaravel-packageopenaiopenai-apipackage

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/marxolity-open-ai/health.svg)

```
[![Health](https://phpackages.com/badges/marxolity-open-ai/health.svg)](https://phpackages.com/packages/marxolity-open-ai)
```

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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