### Install with Composer Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Install the package via Composer. Run this in your Laravel project root. ```bash composer require jeffersongoncalves/laravel-keywords-everywhere ``` -------------------------------- ### Facade Usage Examples Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Use the facade to call all package methods. The keywordData method accepts an array or comma-separated string, with a maximum of 100 keywords. Other methods accept a keyword, domain, or URL as the first argument, with optional country and currency parameters. ```php use JeffersonGoncalves\KeywordsEverywhere\Facades\KeywordsEverywhere; // Keyword data — array or comma-separated string, max 100 keywords KeywordsEverywhere::keywordData(['laravel', 'php'], country: 'us', currency: 'USD'); KeywordsEverywhere::keywordData('laravel,php'); KeywordsEverywhere::relatedKeywords('laravel', country: 'us', currency: 'USD'); KeywordsEverywhere::pasfKeywords('laravel', country: 'us', currency: 'USD'); KeywordsEverywhere::domainKeywords('example.com', country: 'us', currency: 'USD'); KeywordsEverywhere::domainTraffic('example.com', country: 'us'); KeywordsEverywhere::domainBacklinks('example.com'); KeywordsEverywhere::domainUniqueBacklinks('example.com'); KeywordsEverywhere::urlKeywords('https://example.com/page', country: 'us', currency: 'USD'); KeywordsEverywhere::urlTraffic('https://example.com/page', country: 'us'); KeywordsEverywhere::urlBacklinks('https://example.com/page'); KeywordsEverywhere::urlUniqueBacklinks('https://example.com/page'); KeywordsEverywhere::credits(); KeywordsEverywhere::countries(); KeywordsEverywhere::currencies(); ``` -------------------------------- ### Publish Config File Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Optionally publish the package configuration file. Use this command after installation to customize settings. ```bash php artisan vendor:publish --tag="keywords-everywhere-config" ``` -------------------------------- ### Config Options Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Default configuration file. The token falls back to config('services.keywords-everywhere.token') when null. ```php // config/keywords-everywhere.php return [ 'token' => env('KEYWORDS_EVERYWHERE_API_KEY'), 'base_url' => env('KEYWORDS_EVERYWHERE_BASE_URL', 'https://api.keywordseverywhere.com/v1'), ]; ``` -------------------------------- ### Format code with composer format Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Formats the code according to the project's style guidelines. Use this command to ensure consistent code formatting. ```bash composer format ``` -------------------------------- ### Run static analysis with composer analyse Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Runs static analysis on the codebase. Use this command to check for potential issues without executing the code. ```bash composer analyse ``` -------------------------------- ### Run tests with composer test Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Runs the test suite for the package. Use this command to execute all tests defined in the project. ```bash composer test ``` -------------------------------- ### Set API Key in .env Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Add this environment variable to your .env file. Replace the value with your actual API token from the Keywords Everywhere dashboard. ```env KEYWORDS_EVERYWHERE_API_KEY=your-keywords-everywhere-api-token ``` -------------------------------- ### credits() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves account credit information. ```APIDOC ## credits() ### Description Retrieves account credit information. ### Method SDK Method ### Endpoint `KeywordsEverywhere::credits()` ### Parameters None ### Request Example ```php KeywordsEverywhere::credits(); ``` ### Response Returns account credit information. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### Private token() resolution method Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Resolves the Bearer token from config, falling back to services config when the primary key is null. Returns empty string if not a string. ```php private function token(): string { $token = config('keywords-everywhere.token') ?? config('services.keywords-everywhere.token'); return is_string($token) ? $token : ''; } ``` -------------------------------- ### currencies() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves the list of supported currencies. ```APIDOC ## currencies() ### Description Retrieves the list of supported currencies. ### Method SDK Method ### Endpoint `KeywordsEverywhere::currencies()` ### Parameters None ### Request Example ```php KeywordsEverywhere::currencies(); ``` ### Response Returns a list of supported currencies. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### currencies Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Retrieves the list of supported currencies. ```APIDOC ## GET /get_currencies ### Description Retrieves the list of supported currencies. ### Method GET ### Endpoint /get_currencies ### Response #### Success Response (200) - Returns an array of key-value pairs. #### Response Example ```json { "example": "response body" } ``` ### Errors Throws `Illuminate\Http\Client\RequestException` on any non-2xx response. ``` -------------------------------- ### countries() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves the list of supported countries. ```APIDOC ## countries() ### Description Retrieves the list of supported countries. ### Method SDK Method ### Endpoint `KeywordsEverywhere::countries()` ### Parameters None ### Request Example ```php KeywordsEverywhere::countries(); ``` ### Response Returns a list of supported countries. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### Private post() helper for Keywords Everywhere API Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Used by keyword-accepting methods to send POST requests. Resolves base URL and token, throws on non-2xx responses, and returns decoded JSON array or empty array. ```php private function post(string $endpoint, array $body): array { $response = Http::baseUrl($this->baseUrl()) ->withToken($this->token()) ->acceptJson() ->post($endpoint, $body); $response->throw(); $data = $response->json(); return is_array($data) ? $data : []; } ``` -------------------------------- ### Resolve Client via Container Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Inject or resolve the underlying client via the container. This provides an alternative to the facade for calling methods like credits(). ```php use JeffersonGoncalves\KeywordsEverywhere\KeywordsEverywhere; $keywordsEverywhere = app(KeywordsEverywhere::class); $keywordsEverywhere->credits(); ``` -------------------------------- ### domainBacklinks() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves backlinks for a domain. ```APIDOC ## domainBacklinks() ### Description Retrieves backlinks for a domain. ### Method SDK Method ### Endpoint `KeywordsEverywhere::domainBacklinks($domain)` ### Parameters - **$domain** (string) - Required - The domain to get backlinks for (e.g., 'example.com') ### Request Example ```php KeywordsEverywhere::domainBacklinks('example.com'); ``` ### Response Returns backlinks for the domain. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### urlKeywords Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Retrieves keywords associated with a given URL, optionally filtered by country and currency. ```APIDOC ## POST /get_url_keywords ### Description Retrieves keywords associated with a given URL, optionally filtered by country and currency. ### Method POST ### Endpoint /get_url_keywords ### Parameters #### Request Body - **url** (string) - Required - The URL to retrieve keywords for. - **country** (string|null) - Optional - The country code to filter results. - **currency** (string|null) - Optional - The currency code to filter results. ### Response #### Success Response (200) - Returns an array of key-value pairs. #### Response Example ```json { "example": "response body" } ``` ### Errors Throws `Illuminate\Http\Client\RequestException` on any non-2xx response. ``` -------------------------------- ### urlKeywords() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves keywords associated with a URL. ```APIDOC ## urlKeywords() ### Description Retrieves keywords associated with a URL. ### Method SDK Method ### Endpoint `KeywordsEverywhere::urlKeywords($url, $country, $currency)` ### Parameters - **$url** (string) - Required - The URL to get keywords for (e.g., 'https://example.com/page') - **$country** (string) - Optional - Country code (e.g., 'us') - **$currency** (string) - Optional - Currency code (e.g., 'USD') ### Request Example ```php KeywordsEverywhere::urlKeywords('https://example.com/page', country: 'us', currency: 'USD'); ``` ### Response Returns keywords associated with the URL. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### domainUniqueBacklinks() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves unique backlinks for a domain. ```APIDOC ## domainUniqueBacklinks() ### Description Retrieves unique backlinks for a domain. ### Method SDK Method ### Endpoint `KeywordsEverywhere::domainUniqueBacklinks($domain)` ### Parameters - **$domain** (string) - Required - The domain to get unique backlinks for (e.g., 'example.com') ### Request Example ```php KeywordsEverywhere::domainUniqueBacklinks('example.com'); ``` ### Response Returns unique backlinks for the domain. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### Error Handling with RequestException Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Handle non-2xx responses. The package throws Illuminate\Http\Client\RequestException, which provides access to the response status and JSON body via $e->response. ```php use Illuminate\Http\Client\RequestException; try { $data = KeywordsEverywhere::keywordData('laravel'); } catch (RequestException $e) { // $e->response->status(), $e->response->json(), ... } ``` -------------------------------- ### Private keywords() normalization helper Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Converts comma-separated keyword strings into arrays so the API always receives a JSON array under the 'kw' key. Used by keywordData(), relatedKeywords(), and pasfKeywords(). ```php private function keywords(array|string $keywords): array { return is_array($keywords) ? $keywords : explode(',', $keywords); } ``` -------------------------------- ### credits Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Retrieves the current credit balance for the API user. ```APIDOC ## GET /get_credits ### Description Retrieves the current credit balance for the API user. ### Method GET ### Endpoint /get_credits ### Response #### Success Response (200) - Returns an array of key-value pairs. #### Response Example ```json { "example": "response body" } ``` ### Errors Throws `Illuminate\Http\Client\RequestException` on any non-2xx response. ``` -------------------------------- ### urlBacklinks() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves backlinks for a URL. ```APIDOC ## urlBacklinks() ### Description Retrieves backlinks for a URL. ### Method SDK Method ### Endpoint `KeywordsEverywhere::urlBacklinks($url)` ### Parameters - **$url** (string) - Required - The URL to get backlinks for (e.g., 'https://example.com/page') ### Request Example ```php KeywordsEverywhere::urlBacklinks('https://example.com/page'); ``` ### Response Returns backlinks for the URL. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### domainKeywords() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves keywords associated with a domain. ```APIDOC ## domainKeywords() ### Description Retrieves keywords associated with a domain. ### Method SDK Method ### Endpoint `KeywordsEverywhere::domainKeywords($domain, $country, $currency)` ### Parameters - **$domain** (string) - Required - The domain to get keywords for (e.g., 'example.com') - **$country** (string) - Optional - Country code (e.g., 'us') - **$currency** (string) - Optional - Currency code (e.g., 'USD') ### Request Example ```php KeywordsEverywhere::domainKeywords('example.com', country: 'us', currency: 'USD'); ``` ### Response Returns keywords associated with the domain. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### keywordData() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves keyword data including search volume, CPC, and competition for up to 100 keywords. ```APIDOC ## keywordData() ### Description Retrieves keyword data including search volume, CPC, and competition for up to 100 keywords. Accepts an array or comma-separated string. ### Method SDK Method ### Endpoint `KeywordsEverywhere::keywordData($keywords, $country, $currency)` ### Parameters - **$keywords** (array|string) - Required - Array or comma-separated string of keywords, max 100 - **$country** (string) - Optional - Country code (e.g., 'us') - **$currency** (string) - Optional - Currency code (e.g., 'USD') ### Request Example ```php KeywordsEverywhere::keywordData(['laravel', 'php'], country: 'us', currency: 'USD'); KeywordsEverywhere::keywordData('laravel,php'); ``` ### Response Returns keyword data including search volume, CPC, and competition. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### Success test for keyword data endpoint Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Tests that the keywordData method sends a request to the correct endpoint and that the request body contains the expected keyword array. Uses Http::fake() to mock the response and Http::assertSent() to verify the request. ```php it('fetches keyword data from a csv string', function () { Http::fake([ 'api.keywordseverywhere.com/v1/get_keyword_data' => Http::response(['data' => []], 200), ]); app(KeywordsEverywhere::class)->keywordData('laravel,php'); Http::assertSent(fn (Request $request) => $request->data()['kw'] === ['laravel', 'php']); }); ``` -------------------------------- ### urlUniqueBacklinks() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves unique backlinks for a URL. ```APIDOC ## urlUniqueBacklinks() ### Description Retrieves unique backlinks for a URL. ### Method SDK Method ### Endpoint `KeywordsEverywhere::urlUniqueBacklinks($url)` ### Parameters - **$url** (string) - Required - The URL to get unique backlinks for (e.g., 'https://example.com/page') ### Request Example ```php KeywordsEverywhere::urlUniqueBacklinks('https://example.com/page'); ``` ### Response Returns unique backlinks for the URL. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### pasfKeywords() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves PASF (People Also Search For) keywords for a given keyword. ```APIDOC ## pasfKeywords() ### Description Retrieves PASF (People Also Search For) keywords for a given keyword. ### Method SDK Method ### Endpoint `KeywordsEverywhere::pasfKeywords($keyword, $country, $currency)` ### Parameters - **$keyword** (string) - Required - The keyword to get PASF keywords for - **$country** (string) - Optional - Country code (e.g., 'us') - **$currency** (string) - Optional - Currency code (e.g., 'USD') ### Request Example ```php KeywordsEverywhere::pasfKeywords('laravel', country: 'us', currency: 'USD'); ``` ### Response Returns a list of PASF keywords. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### keywordData Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Retrieves keyword data for the given keywords, optionally filtered by country, currency, and data source. ```APIDOC ## POST /get_keyword_data ### Description Retrieves keyword data for the given keywords, optionally filtered by country, currency, and data source. ### Method POST ### Endpoint /get_keyword_data ### Parameters #### Request Body - **keywords** (array|string) - Required - The keywords to retrieve data for. - **country** (string|null) - Optional - The country code to filter results. - **currency** (string|null) - Optional - The currency code to filter results. - **dataSource** (string|null) - Optional - The data source to use. ### Response #### Success Response (200) - Returns an array of key-value pairs. #### Response Example ```json { "example": "response body" } ``` ### Errors Throws `Illuminate\Http\Client\RequestException` on any non-2xx response. ``` -------------------------------- ### pasfKeywords Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Retrieves 'People Also Search For' keywords for the given keywords, optionally filtered by country, currency, and data source. ```APIDOC ## POST /get_pasf_keywords ### Description Retrieves 'People Also Search For' keywords for the given keywords, optionally filtered by country, currency, and data source. ### Method POST ### Endpoint /get_pasf_keywords ### Parameters #### Request Body - **keywords** (array|string) - Required - The keywords to retrieve PASF keywords for. - **country** (string|null) - Optional - The country code to filter results. - **currency** (string|null) - Optional - The currency code to filter results. - **dataSource** (string|null) - Optional - The data source to use. ### Response #### Success Response (200) - Returns an array of key-value pairs. #### Response Example ```json { "example": "response body" } ``` ### Errors Throws `Illuminate\Http\Client\RequestException` on any non-2xx response. ``` -------------------------------- ### Error test for credits endpoint Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Tests that a non-2xx response from the credits endpoint throws a RequestException. Uses Http::fake() to simulate a 401 response and expects the credits() method to throw. ```php it('throws on a non-2xx response', function () { Http::fake([ 'api.keywordseverywhere.com/v1/get_credits' => Http::response(['error' => 'unauthorized'], 401), ]); expect(fn () => app(KeywordsEverywhere::class)->credits()) ->toThrow(RequestException::class); }); ``` -------------------------------- ### domainTraffic() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves traffic data for a domain. ```APIDOC ## domainTraffic() ### Description Retrieves traffic data for a domain. ### Method SDK Method ### Endpoint `KeywordsEverywhere::domainTraffic($domain, $country)` ### Parameters - **$domain** (string) - Required - The domain to get traffic for (e.g., 'example.com') - **$country** (string) - Optional - Country code (e.g., 'us') ### Request Example ```php KeywordsEverywhere::domainTraffic('example.com', country: 'us'); ``` ### Response Returns traffic data for the domain. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### urlTraffic() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves traffic data for a URL. ```APIDOC ## urlTraffic() ### Description Retrieves traffic data for a URL. ### Method SDK Method ### Endpoint `KeywordsEverywhere::urlTraffic($url, $country)` ### Parameters - **$url** (string) - Required - The URL to get traffic for (e.g., 'https://example.com/page') - **$country** (string) - Optional - Country code (e.g., 'us') ### Request Example ```php KeywordsEverywhere::urlTraffic('https://example.com/page', country: 'us'); ``` ### Response Returns traffic data for the URL. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### relatedKeywords() Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/README.md Retrieves related keywords for a given keyword. ```APIDOC ## relatedKeywords() ### Description Retrieves related keywords for a given keyword. ### Method SDK Method ### Endpoint `KeywordsEverywhere::relatedKeywords($keyword, $country, $currency)` ### Parameters - **$keyword** (string) - Required - The keyword to get related keywords for - **$country** (string) - Optional - Country code (e.g., 'us') - **$currency** (string) - Optional - Currency code (e.g., 'USD') ### Request Example ```php KeywordsEverywhere::relatedKeywords('laravel', country: 'us', currency: 'USD'); ``` ### Response Returns a list of related keywords. ### Error Handling Throws `Illuminate\Http\Client\RequestException` on non-2xx response. ``` -------------------------------- ### relatedKeywords Source: https://github.com/jeffersongoncalves/laravel-keywords-everywhere/blob/main/resources/boost/skills/keywords-everywhere-development/SKILL.md Retrieves related keywords for the given keywords, optionally filtered by country, currency, and data source. ```APIDOC ## POST /get_related_keywords ### Description Retrieves related keywords for the given keywords, optionally filtered by country, currency, and data source. ### Method POST ### Endpoint /get_related_keywords ### Parameters #### Request Body - **keywords** (array|string) - Required - The keywords to retrieve related keywords for. - **country** (string|null) - Optional - The country code to filter results. - **currency** (string|null) - Optional - The currency code to filter results. - **dataSource** (string|null) - Optional - The data source to use. ### Response #### Success Response (200) - Returns an array of key-value pairs. #### Response Example ```json { "example": "response body" } ``` ### Errors Throws `Illuminate\Http\Client\RequestException` on any non-2xx response. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.