serpstat / sdk
SDK for Serpstat API v3
Installs: 3 821
Dependents: 0
Suggesters: 0
Security: 0
Stars: 13
Watchers: 5
Forks: 8
Open Issues: 1
Requires
- php: >=5.5.9
- guzzlehttp/guzzle: 6.2.3
This package is auto-updated.
Last update: 2024-10-29 03:38:08 UTC
README
This is the official SDK library for the Serpstat API v3
Getting Started
Step 1: Create authentication token
API Serpstat uses the User Token to authenticate requests. You can create a token on your profile page.
Step 2: Install the Package
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require serpstat/sdk
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 3: Use in application
<?php require_once __DIR__ . '/../vendor/autoload.php'; // configure your application $config = [ 'token' => '19666fc1ae1724da1d5ea2f3a99d5f5a', ]; $domain = 'example.com'; $keywords = 'keywords'; $url = 'http://example.com/page1/'; // init client with your serpstat api token $apiClient = new \Serpstat\Sdk\Core\ApiGuzzleHttpClient($config['token']); // create instance of any api method class // e.g. DomainKeywordsMethod // list of methods classes in folder src\Methods $apiMethod = new \Serpstat\Sdk\Methods\DomainKeywordsMethod( $keywords, \Serpstat\Sdk\Interfaces\IApiClient::SE_GOOGLE_RU ); try { // try call api method $response = $apiClient->call($apiMethod); } catch (\Exception $e) { // catch api error $response = $e->getMessage(); }