Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SEOstats

> 编程语言
Open source

SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.

1.5K stars0 likes2 views
WebsiteGitHub

About

SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.

SEOstats: SEO metrics library for PHP

SEOstats is the open source PHP library to get SEO-relevant website metrics.

SEOstats is used to gather metrics such as detailed searchindex & backlink data, keyword & traffic statistics, website trends, page authority, social visibility, Google Pagerank, Alexa Trafficrank and more.

It offers over 50 different methods to fetch data from sources like Alexa, Google, Mozscape (by Moz - f.k.a. Seomoz), SEMRush, Open-Site-Explorer, Sistrix, Facebook or Twitter.

A variety of (private as well as enterprise) SEO tools have been built using SEOstats.

Dependencies

SEOstats requires PHP version 5.3 or greater and the PHP5-CURL and PHP5-JSON extensions.

Installation

The recommended way to install SEOstats is through composer. To install SEOstats, just create the following composer.json file

{
    "require": {
        "seostats/seostats": "dev-master"
    }
}

and run the php composer.phar install (Windows: composer install) command in path of the composer.json.

Step-by-step example:

If you haven't installed composer yet, here's the easiest way to do so:

# Download the composer installer and execute it with PHP:
user@host:~/> curl -sS https://getcomposer.org/installer | php

# Copy composer.phar to where your local executables live:
user@host:~/> mv /path/given/by/composer-installer/composer.phar /usr/local/bin/composer.phar

# Alternatively: For ease of use, you can add an alias to your bash profile:
# (Note, you need to re-login your terminal for the change to take effect.)
user@host:~/> echo 'alias composer="php /usr/local/bin/composer.phar"' >> ~/.profile

If you have installed composer, follow these steps to install SEOstats:
…

#### Use SEOstats without composer

If composer is no option for you, you can still just download the SEOstats.zip file of the current master branch (version 2.5.2) and extract it. However, currently there is an issues with autoloading and you need to follow the instructions in the comments in the example files in order to use SEOstats (or download zip for the development version of SEOstats (2.5.3) here).

Usage

TOC

  • Configuration
  • Brief Example of Use
  • Alexa Methods
  • Alexa Traffic Metrics
  • Alexa Traffic Graphs
  • Google Methods
  • Toolbar Pagerank
  • Pagespeed Service
  • Websearch Index
  • SERP Details
  • Mozscape Methods
  • Open Site Explorer Methods
  • SEMRush Methods
  • Domain Reports
  • Graphs
  • Sistrix Methods
  • Visibility Index
  • Social Media Methods

Configuration

There're two configuration files to note:

  1. `./SEOstats/Config/ApiKeys.php`
    Client API Keys (currently only required for Mozscape, Google's Pagespeed Service and Sistrix).
  2. `./SEOstats/Config/DefaultSettings.php`
    Some default settings for querying data (mainly locale related stuff).

Brief Example of Use

To use the SEOstats methods, you must include one of the Autoloader classes first (For composer installs: ./vendor/autoload.php; for zip download: ./SEOstats/bootstrap.php).

Now, you can create a new SEOstats instance an bind any URL to the instance for further use with any child class.

…

Alternatively, you can call all methods statically passing the URL to the methods directly.

php
<?php
// Depending on how you installed SEOstats
#require_once __DIR__ . DIRECTORY_SEPARATOR . 'SEOstats' . DIRECTORY_SEPARATOR . 'bootstrap.php';
require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

try {
  $url = 'http://www.google.com/';

  // Get the Google Toolbar Pagerank for the given URL.
  echo \SEOstats\Services\Google::getPageRank($url);
}
catch (SEOstatsException $e) {
  die($e->getMessage());
}

More detailed examples can be found in the ./example directory.


SEOstats Alexa Methods

Alexa Traffic Metrics

…

Alexa Traffic Graphs

…

SEOstats Google Methods

Google Toolbar PageRank

php
<?php
  //  Returns the Google PageRank for the given URL.
  print Google::getPageRank();

Google Pagespeed Service

php
<?php
  // Returns the Google Pagespeed analysis' metrics for the given URL.
  print_r( Google::getPagespeedAnalysis() );

  // Returns the Google Pagespeed analysis' total score.
  print Google::getPagespeedScore();

Google Websearch Index

php
<?php
  // Returns the total amount of results for a Google site-search for the object URL.
  print Google::getSiteindexTotal();

  // Returns the total amount of results for a Google link-search for the object URL.
  print Google::getBacklinksTotal();

  // Returns the total amount of results for a Google search for 'keyword'.
  print Google::getSearchResultsTotal('keyword');

Google SERP Details

php
<?php
  // Returns an array of URLs and titles for the first 100 results for a Google web search for 'keyword'.
  print_r ( Google::getSerps('keyword') );

  // Returns an array of URLs and titles for the first 200 results for a Google site-search for $url.
  print_r ( Google::getSerps("site:$url", 200) );

  // Returns an array of URLs, titles and position in SERPS for occurrences of $url
  // within the first 1000 results for a Google web search for 'keyword'.
  print_r ( Google::getSerps('keyword', 1000, $url) );

SEOstats Mozscape Methods

…

SEOstats Open Site Explorer (by MOZ) Methods

…

SEOstats SEMRush Methods

SEMRush Domain Reports

php
<?php
  // Returns an array containing the SEMRush main report (includes DomainRank, Traffic- & Ads-Data)
  print_r ( SemRush::getDomainRank() );

  // Returns an array containing the domain rank history.
  print_r ( SemRush::getDomainRankHistory() );

  // Returns an array containing data for competeing (auto-detected) websites.
  print_r ( SemRush::getCompetitors() );

  // Returns an array containing data about organic search engine traffic, using explicitly SEMRush's german database.
  print_r ( SemRush::getOrganicKeywords(0, 'de') );

SEMRush Graphs

…

SEOstats Sistrix Methods

Sistrix Visibility Index

php
<?php
  // Returns the Sistrix visibility index
  // @link http://www.sistrix.com/blog/870-sistrix-visibilityindex.html
  print Sistrix::getVisibilityIndex();

SEOstats Social Media Methods

Google+ PlusOnes

php
<?php
  // Returns integer PlusOne count
  print Social::getGooglePlusShares();

Facebook Interactions

php
<?php
  // Returns an array of total counts for overall Facebook interactions count, shares, likes, comments and clicks.
  print_r ( Social::getFacebookShares() );

Twitter Mentions

php
<?php
  // Returns integer tweet count for URL mentions
  print Social::getTwitterShares();

Other Shares

…

License

(c) 2010 - 2016, Stephan Schmitz [email protected]
License: MIT, http://eyecatchup.mit-license.org
URL: https://eyecatchup.github.io

Issues· 51 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

PHP

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言