PHP code example of jeffersongoncalves / laravel-dataforseo

1. Go to this page and download the library: Download jeffersongoncalves/laravel-dataforseo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeffersongoncalves / laravel-dataforseo example snippets


// config/dataforseo.php
return [
    'login' => env('DATAFORSEO_LOGIN'),
    'password' => env('DATAFORSEO_PASSWORD'),
    'base_url' => env('DATAFORSEO_BASE_URL', 'https://api.dataforseo.com/v3'),
];

use JeffersonGoncalves\DataForSeo\Facades\DataForSeo;
use JeffersonGoncalves\DataForSeo\Exceptions\DataForSeoException;

DataForSeo::serp()->google('laravel', 'United States', 'English');
DataForSeo::serp()->locations();
DataForSeo::serp()->languages();

DataForSeo::keywords()->volume(['laravel', 'php'], 2840, 'en');
DataForSeo::keywords()->forSite('example.com', 2840, 'en');
DataForSeo::keywords()->forKeywords(['laravel', 'php'], 2840, 'en');
DataForSeo::keywords()->trends(['laravel', 'php'], 2840, 'en');

DataForSeo::backlinks()->summary('example.com');
DataForSeo::backlinks()->list('example.com', 'as_is', 100);
DataForSeo::backlinks()->referringDomains('example.com', 100);
DataForSeo::backlinks()->anchors('example.com', 100);
DataForSeo::backlinks()->index();

DataForSeo::onPage()->audit('https://example.com', enableJavascript: true);

DataForSeo::labs()->competitors('example.com', 2840, 'en', 100);
DataForSeo::labs()->rankedKeywords('example.com', 2840, 'en', 100);
DataForSeo::labs()->domainIntersection(['example.com', 'rival.com'], 2840, 'en', 100);

try {
    $result = DataForSeo::serp()->google('laravel');
} catch (DataForSeoException $e) {
    // $e->getMessage() — the API's status_message/message, or the raw response body
    // $e->statusCode  — the HTTP status code returned by DataForSEO
}
bash
php artisan vendor:publish --tag="dataforseo-config"
bash
composer analyse