A package that returns Response of Google Bard through API
composer require pj8912/php-bard-api
Follow the gif to get your key
require_once 'vendor/autoload.php';
use Pj8912\PhpBardApi\Bard;
$_ENV['_BARD_API_KEY'] = "Your Key";
$bard = new Bard();
$input_text = "Hello, Bard!"; // Input text for the conversation
$result = $bard->get_answer($input_text); // Get the response from Bard
// Access the result data
$conversation_id = $result["conversation_id"];
$response_id = $result["response_id"];
$factualityQueries = $result["factualityQueries"];
$textQuery = $result["textQuery"];
$choices = $result["choices"];
// reply
$content = $result["content"];
print($content);
This project is licensed under the MIT License
The user assumes all legal responsibilities associated with using the BardAPI package. This PHP package merely facilitates easy access to Google Bard for developers. Users are solely responsible for managing data and using the package appropriately. For further information, please consult the Google Bard Official Document.
Hello there! If you've found my work helpful or useful in any way, please consider supporting me by donating. Your support helps me continue to create and share useful projects with the community. Thank you for your generosity and support! 🤝