1. Go to this page and download the library: Download laswitchtech/php-openai 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/ */
laswitchtech / php-openai example snippets
//Import phpOpenAI class into the global namespace
//These must be at the top of your script, not inside a function
use LaswitchTech\phpOpenAI\phpOpenAI;
//Load Composer's autoloader
//Import phpOpenAI class into the global namespace
//These must be at the top of your script, not inside a function
use LaswitchTech\phpOpenAI\phpOpenAI;
//Load Composer's autoloader
re' => 0,
'max_tokens' => 7,
'top_p' => 1,
'n' => 1,
'stream' => false,
'logprobs' => null,
'stop' => '\n',
]); // Returns an array
//Import phpOpenAI class into the global namespace
//These must be at the top of your script, not inside a function
use LaswitchTech\phpOpenAI\phpOpenAI;
//Load Composer's autoloader
truction' => 'Fix the spelling mistakes',
]); // Returns an array
//Import phpOpenAI class into the global namespace
//These must be at the top of your script, not inside a function
use LaswitchTech\phpOpenAI\phpOpenAI;
//Load Composer's autoloader
/ Returns an array
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.