PHPackages                             hstanleycrow/easyphpopenai - 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. hstanleycrow/easyphpopenai

ActiveLibrary[API Development](/categories/api)

hstanleycrow/easyphpopenai
==========================

Free PHP Library to use OpenAI API into any PHP project

021PHP

Since May 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/hstanleycrow/EasyPHPOpenAI)[ Packagist](https://packagist.org/packages/hstanleycrow/easyphpopenai)[ RSS](/packages/hstanleycrow-easyphpopenai/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

 Easy PHP OpenAI

====================

[](#-----easy-php-openai--)

#### Free PHP Library to use OpenAI API into any PHP project

[](#free-php-library-to-use-openai-api-into-any-php-project)

 [How To Use](#how-to-use) • [Download](#download) • [License](#license)

How To Use
----------

[](#how-to-use)

```
# Clone this repository
$ git clone https://github.com/hstanleycrow/EasyPHPOpenAI/

# install libraries
$ composer update
```

or

```
# Install using composer
$ composer require hstanleycrow/easyphpopenai

### Using Examples
You can adjdust the parameters like temperature, stop, max_tokens, see full list of parameters on the methods.

```php
$openAIAPI = new OpenAIAPI($OPENAI_API_KEY);

# Get Model lists
var_dump($openAIAPI->models());

# Completion Example
/*
$prompt = "Por favor, genera un solo meta título basado en los título de los resultados de búsqueda de Google que proporciono basados en las keywords para las que quiero posicionar. Analiza lo mas relevante, trata de apegartea a la longitud de los titulos de muestra. Estos son los titulos de muestra:###\n1- Zapatos azules baratos\n2- Mejores Zapatos azules\n3- Zapatos Azules duraderos\n4- Zapatos deportivos azules baratos\n\n###";

if ($response = $openAIAPI->complete($prompt)) :
    echo "Titulo: $response";
else :
    echo $openAIAPI->errorMessage();
endif;

# Edit Example
$input = "What day of the wek is it?";
$instruction = "Fix the spelling mistakes";
$openAIAPI->setModel("text-davinci-edit-001");
if ($response = $openAIAPI->edit($input, $instruction)) :
    echo "Respuesta: $response";
else :
    echo $openAIAPI->errorMessage();
endif;

```

Download
--------

[](#download)

You can [download](https://github.com/hstanleycrow/EasyPHPOpenAI/) the latest version here.

PHP Versions
------------

[](#php-versions)

I have tested this class only in this PHP versions. So, if you have an older version and do not work, let me know.

PHP VersionPHP 8.0PHP 8.1PHP 8.2Support
-------

[](#support)

[![Buy Me A Coffee](https://camo.githubusercontent.com/b32d80c4bde7464703f7dcbb8dd24902a7b2de6b0f52a872563f87293d4eb87a/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f637573746f6d5f696d616765732f707572706c655f696d672e706e67)](https://www.buymeacoffee.com/haroldcrow)

License
-------

[](#license)

MIT

---

> [www.hablemosdeseo.net](https://www.hablemosdeseo.net) · GitHub [@hstanleycrow](https://github.com/hstanleycrow) · Twitter [@harold\_crow](https://twitter.com/harold_crow)

###  Health Score

14

—

LowBetter than 1% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/713da77764977a76a357f6b34361a7ab51bd55ea847b84112e3a38f5496af173?d=identicon)[hstanleycrow](/maintainers/hstanleycrow)

---

Top Contributors

[![hstanleycrow](https://avatars.githubusercontent.com/u/7930763?v=4)](https://github.com/hstanleycrow "hstanleycrow (2 commits)")

### Embed Badge

![Health badge](/badges/hstanleycrow-easyphpopenai/health.svg)

```
[![Health](https://phpackages.com/badges/hstanleycrow-easyphpopenai/health.svg)](https://phpackages.com/packages/hstanleycrow-easyphpopenai)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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