Skip to content

jovixv/DFSClient-v3

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
April 2, 2020 12:22
September 22, 2023 17:05
April 2, 2020 12:28
September 25, 2019 17:01
June 27, 2023 17:10
March 8, 2022 18:37
December 18, 2019 15:41
September 25, 2019 17:01
September 25, 2019 17:01

logo

This is a PHP client library for the DataForSEO API. The library describes models for working with API endpoints. As new endpoints are added, the library will be updated.

Requirements

PHP 7.3 and later

Installation

composer require jovix/dataforseo-clientv3

Usage

In the simple version, your application should look like this:

public
   config.php
   index.php
vendor
 composer.json
 composer.lock

The config.php file contains:

<?php  
return $config = [  
   'DATAFORSEO_LOGIN' => 'login',  
   'DATAFORSEO_PASSWORD' => 'password',  
   'timeoutForEachRequests' => 120,  
   'apiVersion' => '/v3/',  
   'url' => 'https://api.dataforseo.com',  
 // You can set extra paths for Entities  
 // For all entity we use namespace: DFSClientV3\Entity\Custom
 // Last index will have the priority
   'extraEntitiesPaths' => [  
      'your full path to extra entity',  
      'your full path to extra entity'  
  ],  
];

The index.php file contains:

<?php  
include_once '../vendor/autoload.php';  
  
$client = new DFSClientV3\DFSClient();  
$client->setConfig('config.php');  
  
// You will receive detailed information about your API usage  
$model = new \DFSClientV3\Models\CommonApi\User();  
// You can get an object whose essence is described in the appropriating entity 
// (attention, may contain outdated data)
$res = $model->get();  
print_r($res);  
// You can get the JSON answer  
$res = $model->getAsJson();  
print_r($res);  
  
  
// You will receive SERP data specific to the indicated keyword, search engine, and location parameters
$model = new \DFSClientV3\Models\SerpApi\SettingSerpLiveAdvanced();  
$model->setSe("google");  
$model->setSeType("organic");  
$model->setKeyword("seo");  
$model->setLocationCode(2840);  
$model->setLanguageCode("en");  
$res = $model->getAsJson();  
print_r($res);

Documentation for API

https://docs.dataforseo.com/v3