PHP code example of routerbase / client

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

    

routerbase / client example snippets




use RouterBase\Client;

$client = new Client(getenv('ROUTERBASE_API_KEY'));

$response = $client->chatCompletion([
    ['role' => 'user', 'content' => 'Explain RouterBase in one sentence.'],
]);

echo $response['choices'][0]['message']['content'] . PHP_EOL;