1. Go to this page and download the library: Download marxolity/open-ai 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/ */
marxolity / open-ai example snippets
use \Marxolity\OpenAi\Facades\OpenAi;
$responseMessage = OpenAi::query("What is Laravel?")
->setModel('gpt-4')
->send()->responseMessage;
$responseMessage = OpenAi::query("What is Laravel?")->send()->responseMessage;
Laravel is a free, open-source PHP web framework used for developing web applications. It fol...
$responseArray = OpenAi::query("What is Laravel?")->send()->toArray();
$responseJson = OpenAi::query("What is Laravel?")->send()->toJson();
$responseXml = OpenAi::query("What is Laravel?")->send()->toXml();