PHP code example of adityadees / laravel-google-bard

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

    

adityadees / laravel-google-bard example snippets


$bard = (new LaravelBard())->get_answer('type_your_text_here');

# to get the reply just access this array
$bard["content"];

# you can access others array like this
$bard["conversation_id"];
$bard["response_id"];
$bard["factualityQueries"];
$bard["textQuery"];
$bard["choices"];

$bard = (new LaravelBard())->get_answer('hello whats your name');
dd($bard["content"]);