{"id":23169510,"url":"https://github.com/khaledalam/bard-sdk-php","last_synced_at":"2025-08-18T07:31:03.536Z","repository":{"id":167735536,"uuid":"643022007","full_name":"khaledalam/bard-sdk-php","owner":"khaledalam","description":"PHP SDK/API for Google Bard (experiment version) (unofficial)","archived":false,"fork":false,"pushed_at":"2023-06-01T08:48:00.000Z","size":460,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-25T20:16:29.146Z","etag":null,"topics":["ai","bard","bard-ai","bard-api","chatbot","google","sdk","sdk-php"],"latest_commit_sha":null,"homepage":"https://bard.google.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/khaledalam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-19T22:28:45.000Z","updated_at":"2025-07-19T12:28:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"d0e9fee7-7e25-4cbd-9a5c-614684f73664","html_url":"https://github.com/khaledalam/bard-sdk-php","commit_stats":null,"previous_names":["khaledalam/bard-sdk-php"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/khaledalam/bard-sdk-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fbard-sdk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fbard-sdk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fbard-sdk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fbard-sdk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khaledalam","download_url":"https://codeload.github.com/khaledalam/bard-sdk-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khaledalam%2Fbard-sdk-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270961453,"owners_count":24675914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","bard","bard-ai","bard-api","chatbot","google","sdk","sdk-php"],"created_at":"2024-12-18T03:17:56.644Z","updated_at":"2025-08-18T07:31:03.526Z","avatar_url":"https://github.com/khaledalam.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# \u003cimg src=\"https://1000logos.net/wp-content/uploads/2023/05/Bard-AI-Logo.png\" height=\"25px\"\u003e\u003c/a\u003e PHP SDK/API for Google Bard (experiment version) (unofficial)\n\n[![Downloads](https://poser.pugx.org/khaledalam/bard-sdk-php/d/total.svg)](https://packagist.org/packages/khaledalam/bard-sdk-php)\n[![Latest Stable Version](https://poser.pugx.org/khaledalam/bard-sdk-php/version.svg)](https://packagist.org/packages/khaledalam/bard-sdk-php)\n[![PHP Version Require](http://poser.pugx.org/khaledalam/bard-sdk-php/require/php)](https://packagist.org/packages/khaledalam/bard-sdk-php)\n[![License](https://poser.pugx.org/khaledalam/bard-sdk-php/license.svg)](https://packagist.org/packages/khaledalam/bard-sdk-php)\n[![composer.lock available](https://poser.pugx.org/khaledalam/bard-sdk-php/composerlock)](https://packagist.org/packages/khaledalam/bard-sdk-php)\n![workflows CI](https://github.com/khaledalam/bard-sdk-php/actions/workflows/ci.yml/badge.svg)\n\n\n\nReverse engineering of Google's Bard chatbot.\n\n## Disclamer\n- ApiKeyCookie.php implemented only for easing the access to Google Bard, any legal responsibilities lie with the user.\n- Don't expose your `__Secure-1PSID` cookie value on the internet.\n\n\n## Install\n\u003e $ composer require khaledalam/bard-sdk-php\n\n## Test\n\u003e $ composer run test\n\n## Auth\n1. Navigate to https://bard.google.com/\n2. Open \"Developer Tools\" from browser settings or click [F12] shortcut for console.\n3. Go to Application tab =\u003e open \"Cookies\" from left tab =\u003e click \"https://accounts.google.com\" =\u003e Copy the value of `__Secure-1PSID` cookie.\u003cbr /\u003e\u003cimg height=\"300\" src=\"./get_cookie_value.png\" width=\"500\"/\u003e\n\n## Simple Usage\n\nChange `_YOUR_COOKIE_VALUE_`\n```php\n\u003c?php\n\nrequire_once('./vendor/autoload.php');\n\nuse Khaledalam\\BardSdkPhp\\ApiKey\\ApiKeyCookie;\nuse Khaledalam\\BardSdkPhp\\Bard;\n\ntry {\n    // __Secure-1PSID value\n    $apiKey = '_YOUR_COOKIE_VALUE_';\n\n    $question = \"What is the recent stable version LTS of Ubuntu?\";\n\n    $bard = new Bard(new ApiKeyCookie($apiKey));\n\n    $answer = $bard-\u003eask($question);\n\n    print_r($answer['content']);\n    /*\n    Output (May-2023):\n    \n    The most recent stable version of Ubuntu LTS is Ubuntu 22.04 LTS, codenamed \"Jammy Jellyfish.\" It was released on April 21, 2022, and will be supported with free security and maintenance updates for five years, until April 2027.\n\n    Ubuntu LTS releases are designed for use in enterprise and server environments, where reliability and stability are critical. They are also a good choice for home users who want a reliable and long-lasting operating system.\n    */\n\n} catch (Exception $e)\n{\n    die(\"Error: \" . $e-\u003egetMessage());\n}\n\n```\n\nOutput (May-2023):\n```\nThe most recent stable version of Ubuntu LTS is Ubuntu 22.04 LTS, codenamed \"Jammy Jellyfish.\" It was released on April 21, 2022, and will be supported with free security and maintenance updates for five years, until April 2027.\n\nUbuntu LTS releases are designed for use in enterprise and server environments, where reliability and stability are critical. They are also a good choice for home users who want a reliable and long-lasting operating system.\n```\n\n## Examples\n\nExample1(\u003ca href=\"./examples/world_datetime_ai\"\u003eworld_datatime_ai\u003c/a\u003e):\n\u003e php examples/world_datetime_ai/main.php\n\nExample2(\u003ca href=\"./examples/docker\"\u003edocker\u003c/a\u003e)\n\n\n## Technical\n\n### Diagram\n\n\u003cimg src=\"./diagram.png\"\u003e\n\n### TODOs:\n- [x] Cookie\n- [ ] Api key\n- [ ] codecov\n- [x] Testing\n- [x] CI GitHub actions\n\n### License\n- [MIT](https://opensource.org/license/mit/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhaledalam%2Fbard-sdk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhaledalam%2Fbard-sdk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhaledalam%2Fbard-sdk-php/lists"}