Looking to hire Laravel developers? Try LaraJobs

laravel-dataforseo maintained by jeffersongoncalves

Description
A Laravel client for the DataForSEO API — SERP, Keywords Data, Backlinks, OnPage, and DataForSEO Labs endpoints.
Last update
2026/09/07 00:32 (dev-main)
License
Links
Downloads
1

Comments
comments powered by Disqus

Laravel DataForSEO

Laravel DataForSEO

Tests PHPStan Code Style Latest Version on Packagist Total Downloads License

A Laravel client for the DataForSEO API. A fluent DataForSeo facade groups the SERP, Keywords Data, Backlinks, OnPage, and DataForSEO Labs endpoints behind resource accessors, authenticates every request with HTTP Basic Auth, and throws a DataForSeoException on a non-2xx response instead of returning a silent error array.

Features

  • SERPserp()->google(), locations(), languages()
  • Keywords Datakeywords()->volume(), forSite(), forKeywords(), trends()
  • Backlinksbacklinks()->summary(), list(), referringDomains(), anchors(), index()
  • OnPageonPage()->audit()
  • DataForSEO Labslabs()->competitors(), rankedKeywords(), domainIntersection()
  • Thin by design — every method returns the raw decoded JSON response as an array, no DTOs
  • Fails loud — a non-2xx response throws DataForSeoException carrying the API's error message and HTTP status code

Installation

composer require jeffersongoncalves/laravel-dataforseo

Optionally publish the config file:

php artisan vendor:publish --tag="dataforseo-config"

Configuration

Add to your .env:

DATAFORSEO_LOGIN=your-login
DATAFORSEO_PASSWORD=your-password

Create an account at https://app.dataforseo.com/register to get your login and password.

Config Options

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

Usage

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

SERP

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

Keywords Data

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');

Backlinks

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();

OnPage

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

DataForSEO Labs

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);

Handling errors

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
}

Testing

composer test

Static Analysis

composer analyse

Code Formatting

composer format

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.