Registry / http-client / openai-php-laravel

openai-php-laravel

JSON →
library0.20.0phppackagistunverified

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

composer require openai-php/laravel
INSTALL
IMPORT
SIG · OPENAI-PHP-LARAVEL
O
openai-php-laravel
http-clientphpv0.20.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OpenAI
use OpenAI\Laravel\Facades\OpenAI;

Send a chat completion request to OpenAI

use OpenAI\Laravel\Facades\OpenAI; $result = OpenAI::chat()->create([ 'model' => 'gpt-3.5-turbo', 'messages' => [ ['role' => 'user', 'content' => 'Hello!'], ], ]); echo $result->choices[0]->message->content;
Debug
Known issues
gotchaRequires an OpenAI API key set in .env as OPENAI_API_KEY
fix
Add OPENAI_API_KEY=your-key to your .env file
affects: >=0.1.0
Upgrade
Version history
0.20.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Resources
openai-php-laravel — pip install openai-php-laravel · libregistry