pj8912 / php-bard-api
A PHP package for interacting with the Bard API
Fund package maintenance!
pj8912
Installs: 26 092
Dependents: 0
Suggesters: 0
Security: 0
Stars: 35
Watchers: 7
Forks: 12
Open Issues: 0
pkg:composer/pj8912/php-bard-api
Requires
- php: ^8.1
README
❗This repo is archived❗
Use Official Gemini API
https://ai.google.dev/
A package that returns Response of Google Bard through API
Install
composer require pj8912/php-bard-api
Get Your Keys
- Open bard.google.com
- Open developer tools, click
Applicationtab - In Application under the
Storageyou will findcookiesdropdown - Under cookies click on
https://bard.google.comwhich will show you all the cookies being used asNameandValue - Copy the values the cookies
__Secure-1PSIDand__Secure-1PSIDTS
Run
the value of
__Secure-1PSIDTSwill have to be changed frequently (Google changes it)
require_once 'vendor/autoload.php'; use Pj8912\PhpBardApi\Bard; //two keys are required which are two cookies values $_ENV['BARD_API_KEY_X'] = " value of cookie '__Secure-1PSID' "; $_ENV['BARD_API_KEY_Y'] = " value of cookie '__Secure-1PSIDTS' " $bard = new Bard(); $input_text = "Hello, Bard!"; // Input text for the conversation $result = $bard->get_answer($input_text); // Get the response from Bard // bard reply print($result['choices'][0]['content'][0]);
License
This project is licensed under the MIT License
Reference
Important Notice
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.