Skip to content

Commit

Permalink
rename to laravel google bard
Browse files Browse the repository at this point in the history
  • Loading branch information
adityadees committed May 18, 2023
1 parent 72e8ab3 commit 3b0f6ec
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 38 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# laravel-bard
# laravel-google-bard
A Laravel Package for Google Bard AI Chatbot


## INSTALATION
- `composer require adityadees/laravel-bard`
- `php artisan vendor:publish --tag=laravel-lighthouse`
- New file `laravel-bard.php` will created under `config` folder
- `composer require adityadees/laravel-google-bard`
- `php artisan vendor:publish --tag=laravel-google-bard`
- New file `laravel-google-bard.php` will created under `config` folder
- Fill the `bard_token` with your token


Expand All @@ -14,12 +14,12 @@ Visit https://bard.google.com/
Go to Developer tools or press F12
Application → Cookies → Copy the value of __Secure-1PSID cookie.

<img width="864" alt="image" src="https://github.com/adityadees/laravel-bard/assets/37553901/2cea58d3-0c74-464d-9f75-88ab68f213e6">
<img width="864" alt="image" src="https://github.com/adityadees/laravel-google-bard/assets/37553901/2cea58d3-0c74-464d-9f75-88ab68f213e6">


## RUN
```php
$bard = (new LaravelBard())->get_answer('type_your_text_here');
$bard = (new LaravelGoogleBard())->get_answer('type_your_text_here');

# to get the reply just access this array
$bard["content"];
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "adityadees/laravel-bard",
"name": "adityadees/laravel-google-bard",
"description": "A Laravel Package for Google Bard AI Chatbot",
"keyword": [
"google-bard",
Expand All @@ -13,7 +13,7 @@
"license": "MIT",
"autoload": {
"psr-4": {
"AdityaDees\\LaravelBard\\": "src/"
"AdityaDees\\LaravelGoogleBard\\": "src/"
}
},
"authors": [
Expand All @@ -25,7 +25,7 @@
"extra": {
"laravel": {
"providers": [
"AdityaDees\\LaravelBard\\LaravelBardServiceProvider"
"AdityaDees\\LaravelGoogleBard\\LaravelGoogleBardServiceProvider"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion config/laravel-bard.php → config/laravel-google-bard.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
return [
/*
|--------------------------------------------------------------------------
| BARD_API
| BARD TOKEN
|--------------------------------------------------------------------------
|
| Using `__Secure-1PSID` inside
Expand Down
2 changes: 1 addition & 1 deletion src/Exceptions/ErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace AdityaDees\LaravelBard\Exceptions;
namespace AdityaDees\LaravelGoogleBard\Exceptions;

use Exception;

Expand Down
22 changes: 0 additions & 22 deletions src/LaravelBardServiceProvider.php

This file was deleted.

10 changes: 5 additions & 5 deletions src/LaravelBard.php → src/LaravelGoogleBard.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

declare(strict_types=1);

namespace AdityaDees\LaravelBard;
namespace AdityaDees\LaravelGoogleBard;

use AdityaDees\LaravelBard\Exceptions\ErrorException;
use AdityaDees\LaravelGoogleBard\Exceptions\ErrorException;

/**
* LaravelBard
* LaravelGoogleBard
*
* @author Aditya Dharmawan Saputra @adityadees
*
*/

class LaravelBard
class LaravelGoogleBard
{
private $proxies;
private $timeout;
Expand All @@ -29,7 +29,7 @@ public function __construct($timeout = 6, $proxies = null, $session = null)
{
$this->proxies = $proxies;
$this->timeout = $timeout;
$this->token = config('laravel-bard.bard_token');
$this->token = config('laravel-google-bard.bard_token');
$headers = [
"Host: bard.google.com",
"X-Same-Domain: 1",
Expand Down
22 changes: 22 additions & 0 deletions src/LaravelGoogleBardServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace AdityaDees\LaravelGoogleBard;

use Illuminate\Support\ServiceProvider;

class LaravelGoogleBardServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->publishes([
__DIR__ . '/../config/laravel-google-bard.php' => config_path('laravel-google-bard.php'),
], 'laravel-google-bard');
}

public function register(): void
{
$this->mergeConfigFrom(__DIR__ . '/../config/laravel-google-bard.php', 'laravel-google-bard');
}
}

0 comments on commit 3b0f6ec

Please sign in to comment.