PHPackages                             pj8912/php-bard-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. pj8912/php-bard-api

AbandonedArchivedLibrary[API Development](/categories/api)

pj8912/php-bard-api
===================

A PHP package for interacting with the Bard API

1.0.1(2y ago)3428.1k↑75%10MITPHPPHP ^8.1

Since May 18Pushed 2y ago6 watchersCompare

[ Source](https://github.com/pj8912/php-bard-api)[ Packagist](https://packagist.org/packages/pj8912/php-bard-api)[ GitHub Sponsors](https://github.com/pj8912)[ RSS](/packages/pj8912-php-bard-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

php-bard-api
============

[](#php-bard-api)

***❗This repo is archived❗***

### Use Official Gemini API

[](#use-official-gemini-api)

```
https://ai.google.dev/

```

---

 [![PHP](https://camo.githubusercontent.com/c9d8be110668b4390459148e92b7ae34ce1f559624e158f83e15d76036de3108/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d696e6469676f)](https://camo.githubusercontent.com/c9d8be110668b4390459148e92b7ae34ce1f559624e158f83e15d76036de3108/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312d696e6469676f)[![composer bard package](https://camo.githubusercontent.com/134d28660e4ad560f56804282132133334e437a02906a49f85eba12ebbb0a643/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d426172644150492d64656661756c74)](https://camo.githubusercontent.com/134d28660e4ad560f56804282132133334e437a02906a49f85eba12ebbb0a643/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d426172644150492d64656661756c74)[![bard api](https://camo.githubusercontent.com/6acc917169a4c09951db13f6ce8bcf4932426d3cbcb217c76b231cd0b0c487f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f426172644150492d64656661756c74)](https://camo.githubusercontent.com/6acc917169a4c09951db13f6ce8bcf4932426d3cbcb217c76b231cd0b0c487f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f426172644150492d64656661756c74)[![composer version](https://camo.githubusercontent.com/68ff2060685f3fe8a768b032aa7ff2fd1df7d189e404d37f4fa35a2751539986/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d322e322e362d6f72616e6765)](https://camo.githubusercontent.com/68ff2060685f3fe8a768b032aa7ff2fd1df7d189e404d37f4fa35a2751539986/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d322e322e362d6f72616e6765)

---

> A package that returns Response of Google Bard through API

Install
-------

[](#install)

```
composer require pj8912/php-bard-api

```

Get Your Keys
-------------

[](#get-your-keys)

- Open [bard.google.com](https://bard.google.com/)
- Open developer tools, click `Application` tab
- In Application under the `Storage` you will find `cookies` dropdown
- Under cookies click on `https://bard.google.com` which will show you all the cookies being used as `Name` and `Value`
- Copy the values the cookies`__Secure-1PSID` and `__Secure-1PSIDTS`

Run
---

[](#run)

> **the value of `__Secure-1PSIDTS` will 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
-------

[](#license)

This project is licensed under the [MIT](https://opensource.org/license/mit/) License

Reference
---------

[](#reference)

- [dsdanielpark/Bard-API](https://github.com/dsdanielpark/Bard-API)

### Important Notice

[](#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.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~57 days

Total

2

Last Release

1039d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/13bddb056b36dfe4618e4247878b05a8da7c6d4588eb6d6826216b5f2d55163c?d=identicon)[pj8912](/maintainers/pj8912)

---

Top Contributors

[![pj8912](https://avatars.githubusercontent.com/u/59218902?v=4)](https://github.com/pj8912 "pj8912 (32 commits)")[![pixkk](https://avatars.githubusercontent.com/u/30828435?v=4)](https://github.com/pixkk "pixkk (2 commits)")

---

Tags

bardgenerative-aigoogle-bardphp

### Embed Badge

![Health badge](/badges/pj8912-php-bard-api/health.svg)

```
[![Health](https://phpackages.com/badges/pj8912-php-bard-api/health.svg)](https://phpackages.com/packages/pj8912-php-bard-api)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
