PHP code example of fonclub / openai-laravel-client
1. Go to this page and download the library: Download fonclub/openai-laravel-client library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fonclub / openai-laravel-client example snippets
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.
bash
composer
bash
php artisan vendor:publish --provider="OpenAI\Laravel\ServiceProvider"