1. Go to this page and download the library: Download lewenbraun/ollama-php-sdk 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/ */
lewenbraun / ollama-php-sdk example snippets
use Lewenbraun\Ollama\Ollama;
$client = Ollama::client('http://localhost:11434');
$completion = $client->completion()->create([
'model' => 'llama3.2',
'prompt' => 'Hello',
// 'stream' is false by default
]);
echo $completion->response;