slvler / brave-search-api
Brave search api API wrapper for Laravel
v1.2.0
2024-11-15 06:31 UTC
Requires
- illuminate/support: ^10.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- guzzlehttp/guzzle: ^7.9
- orchestra/testbench: ^8.18
- phpunit/phpunit: ^10.5
README
Introduction
Brave Web Search API is a REST API to query Brave Search and get back search results from the web. The following sections describe how to curate requests, including parameters and headers, to Brave Web Search API and get a JSON response back. This package provides a convenient wrapper to the Brave Web Search API for Laravel applications.
Requirements
- PHP 8.0+
- Laravel 10.x
Installation
To install this package tou can use composer:
composer require slvler/brave-search-api
Usage
- First, you should extract the config/brave.php file to the config folder.
php artisan vendor:publish --tag=brave
- First of all we'll add the API key and API Url of the service we're using to our .env file of our project. If you don't have an account yet on api.search.brave.com, you should create one. Once you have an account you can copy your API key from the dashboard page and put it into you .env file.
BRAVE_BASE_URL="https://api.search.brave.com" BRAVE_API_KEY=
Web text search
- You can use it to search on brave api:
use Slvler\Brave\Facades\Brave; Brave::web(['q' => "bitcoin"])->result();
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.
Contributing
You're very welcome to contribute. Please see CONTRIBUTING for details.