PHP code example of qwen-php / qwen-laravel

1. Go to this page and download the library: Download qwen-php/qwen-laravel 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/ */

    

qwen-php / qwen-laravel example snippets


QWEN_API_KEY="your_api_key"

use QwenClient;

$Qwen = app(QwenClient::class);
$response = $Qwen->query('Hello qwen, I am Laravel Framework , how are you Today ^_^ ?')->run();
print_r("qwen API response : " . $response);

use QwenClient;

$Qwen = app(QwenClient::class);

// Another way, with customization
$response = $Qwen
    ->query('Hello qwen, how are you ?', 'system')
    ->query('Hello qwen, my name is PHP ', 'user')
    ->withModel("qwen-vl-max")
    ->setTemperature(1.5)
    ->run();

print_r("qwen API response : " . $response);
bash
composer 
bash
php artisan vendor:publish --tag=qwen