2017 © Pedro Peláez
 

library semrush-api

SEMrush API client

image

silktide/semrush-api

SEMrush API client

  • Friday, June 8, 2018
  • by Dolondro
  • Repository
  • 12 Watchers
  • 5 Stars
  • 3,079 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 1 Open issues
  • 25 Versions
  • 7 % Grown

The README.md

SEMrush API client

Build Status Code Climate Test Coverage, (*1)

A PHP API client for the SEMrush API., (*2)

Supported actions:

  • domain_ranks
  • domain_domains
  • domain_rank
  • domain_rank_history
  • domain_organic
  • domain_adwords
  • domain_adwords_unique
  • advertiser_publishers
  • advertiser_text_ads
  • advertiser_rank
  • phrase_this (https://www.semrush.com/api-analytics/#phrase_this)

Usage

Installation

    composer require silktide/semrush-api

Setup

This library was designed to use Dependency Injection (DI). If you don't use DI, you could use the factory to set up the API client:, (*3)

    $client = \Silktide\SemRushApi\ClientFactory::create("[YOUR SEMRUSH API KEY]");

Caching

The API library can use a PSR-16 style cache to reduce calls to the API., (*4)

    $cache = new Psr16CompliantCache();
    $client->setCache($cache)

API calls

Domain ranks

Getting the SEMrush "domain_ranks" for a website:, (*5)

    $result = $client->getDomainRanks('silktide.com');

Domain rank

Getting the SEMrush "domain_rank" for a website:, (*6)

    $result = $client->getDomainRank(
        'silktide.com',
        [
            'database' => \Silktide\SemRushApi\Data\Database::DATABASE_GOOGLE_US
        ]
    );

Domain rank history

Getting the SEMrush "domain_rank_history" for a website:, (*7)

    $result = $client->getDomainRankHistory(
        'silktide.com',
        [
            'database' => \Silktide\SemRushApi\Data\Database::DATABASE_GOOGLE_US
        ]
    );

Domain organic

Getting the SEMrush "domain_organic" for a website:, (*8)

    $result = $client->getDomainOrganic(
        'silktide.com',
        [
            'database' => \Silktide\SemRushApi\Data\Database::DATABASE_GOOGLE_US
        ]
    );

Domain adwords

Getting the SEMrush "domain_adwords" for a website:, (*9)

    $result = $client->getDomainAdwords(
        'silktide.com',
        [
            'database' => \Silktide\SemRushApi\Data\Database::DATABASE_GOOGLE_US
        ]
    );

Domain adwords unique

Getting the SEMrush "domain_adwords_unique" for a website:, (*10)

    $result = $client->getDomainAdwordsUnique(
        'silktide.com',
        [
            'database' => \Silktide\SemRushApi\Data\Database::DATABASE_GOOGLE_US
        ]
    );

Using options

Here's an example of passing options to the domain ranks action in order to return a specific set of columns., (*11)

    $result = $client->getDomainRanks('silktide.com', [
        'export_columns' => [
            \Silktide\SemRushApi\Data\Column::COLUMN_OVERVIEW_ADWORDS_BUDGET,
            \Silktide\SemRushApi\Data\Column::COLUMN_OVERVIEW_ADWORDS_KEYWORDS,
            \Silktide\SemRushApi\Data\Column::COLUMN_OVERVIEW_ADWORDS_TRAFFIC
         ]
    ]);

Using results

All API actions will return a Result object. Result objects contain a number of Row objects and are iterable and countable. Here's a (non exhaustive) example of how they can be used., (*12)

    foreach ($result as $row) {
        $budget = $row->getValue(\Silktide\SemRushApi\Data\Column::COLUMN_OVERVIEW_ADWORDS_BUDGET);
        echo "\nThe AdWords spend of this site in the last month was an estimated ${$budget}";
    }

The Versions

08/06 2018

dev-master

9999999-dev

SEMrush API client

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

The Development Requires

by Andrew Waite

26/04 2018

dev-api-usage-tracking

dev-api-usage-tracking

SEMrush API client

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

by Andrew Waite

22/01 2018

1.0.2

1.0.2.0

SEMrush API client

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

by Andrew Waite

19/01 2018

1.0.1

1.0.1.0

SEMrush API client

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

by Andrew Waite

18/01 2018
11/01 2017

0.9.0

0.9.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

06/01 2017

0.8.0

0.8.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

05/01 2017

0.7.1

0.7.1.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

15/11 2016

0.7.0

0.7.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

05/05 2016

0.6.0

0.6.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

12/04 2016

0.5.1

0.5.1.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

11/04 2016

0.5

0.5.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

22/02 2016

0.4.6

0.4.6.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

09/12 2015

0.4.5

0.4.5.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

07/04 2015

dev-pre-release

dev-pre-release

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

07/04 2015

0.4.4

0.4.4.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

07/04 2015

0.4.3

0.4.3.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

07/04 2015

0.4.2

0.4.2.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

07/04 2015

0.4.1

0.4.1.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

01/04 2015

0.4.0

0.4.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

01/04 2015

0.3.0

0.3.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

31/03 2015

dev-monolog

dev-monolog

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

30/03 2015

0.2.0

0.2.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite

30/03 2015

0.1.0

0.1.0.0

SEMrush API client

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

by Andrew Waite