• Stars
    star
    1,467
  • Rank 32,057 (Top 0.7 %)
  • Language
    PHP
  • License
    MIT License
  • Created over 13 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

SEOstats: SEO metrics library for PHP

License Scrutinizer Code Quality Rating Build Status Scrutinizer Test Coverage Report Latest Stable Version Latest Unstable Version Monthly Downloads

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: ``` # Create a new directory and cd into it: user@host:~/> mkdir /path/to/seostats && cd /path/to/seostats

Create the composer.json for SEOstats:

user@host:/path/to/seostats> echo '{"require":{"seostats/seostats":"dev-master"}}' > composer.json

Run the install command:

user@host:/path/to/seostats> composer install Loading composer repositories with package information Installing dependencies (including require-dev)

  • Installing seostats/seostats (dev-master 4c192e4) Cloning 4c192e43256c95741cf85d23ea2a0d59a77b7a9a

Writing lock file Generating autoload files

You're done. For a quick start, you can now

copy the example files to the install directory:

user@host:/path/to/seostats> cp ./vendor/seostats/seostats/example/*.php ./

Your SEOstats install directory should look like this now:

user@host:/path/to/seostats> ls -1 composer.json composer.lock get-alexa-graphs.php get-alexa-metrics.php get-google-pagerank.php get-google-pagespeed-analysis.php get-google-serps.php get-opensiteexplorer-metrics.php get-semrush-graphs.php get-semrush-metrics.php get-sistrix-visibilityindex.php get-social-metrics.php vendor

<hr>
#### Use SEOstats without composer

If composer is no option for you, you can still just download the [`SEOstats.zip`](https://github.com/eyecatchup/SEOstats/archive/master.zip) file of the current master branch (version 2.5.2) and extract it. However, currently [there is an issues with autoloading](https://github.com/eyecatchup/SEOstats/issues/49) 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](https://github.com/eyecatchup/SEOstats/archive/dev-253.zip)).

## Usage

### TOC

* <a href='#configuration'>Configuration</a>
* <a href='#brief-example-of-use'>Brief Example of Use</a>
* <a href='#seostats-alexa-methods'>Alexa Methods</a>
 * <a href='#alexa-traffic-metrics'>Alexa Traffic Metrics</a>
 * <a href='#alexa-traffic-graphs'>Alexa Traffic Graphs</a>
* <a href='#seostats-google-methods'>Google Methods</a>
 * <a href='#google-toolbar-pagerank'>Toolbar Pagerank</a>
 * <a href='#google-pagespeed-service'>Pagespeed Service</a>
 * <a href='#google-websearch-index'>Websearch Index</a>
 * <a href='#google-serp-details'>SERP Details</a>
* <a href='#seostats-mozscape-methods'>Mozscape Methods</a>  
* <a href='#seostats-open-site-explorer-methods'>Open Site Explorer Methods</a>
* <a href='#seostats-semrush-methods'>SEMRush Methods</a>
 * <a href='#semrush-domain-reports'>Domain Reports</a>
 * <a href='#semrush-graphs'>Graphs</a>
* <a href='#seostats-sistrix-methods'>Sistrix Methods</a>
 * <a href='#sistrix-visibility-index'>Visibility Index</a>
* <a href='#seostats-social-media-methods'>Social Media Methods</a>

<hr>

### Configuration
There're two configuration files to note:
<ol>
<li>`./SEOstats/Config/ApiKeys.php`<br>
<em>Client API Keys (currently only required for Mozscape, Google's Pagespeed Service and Sistrix).</em>
</li>
<li>`./SEOstats/Config/DefaultSettings.php`<br>
<em>Some default settings for querying data (mainly locale related stuff).</em>
</li>
</ol>
<hr>

### 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.

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

use \SEOstats\Services as SEOstats;

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

  // Create a new SEOstats instance.
  $seostats = new \SEOstats\SEOstats;

  // Bind the URL to the current SEOstats instance.
  if ($seostats->setUrl($url)) {

	echo SEOstats\Alexa::getGlobalRank();
	echo SEOstats\Google::getPageRank();
  }
}
catch (SEOstatsException $e) {
  die($e->getMessage());
}

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

<?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

<?php
  // Returns the global Alexa Traffic Rank (last 3 months).
  print Alexa::getGlobalRank();

  // Returns the global Traffic Rank for the last month.
  print Alexa::getMonthlyRank();

  // Returns the global Traffic Rank for the last week.
  print Alexa::getWeeklyRank();

  // Returns the global Traffic Rank for yesterday.
  print Alexa::getDailyRank();

  // Returns the country-specific Alexa Traffic Rank.
  print_r( Alexa::getCountryRank() );

  // Returns Alexa's backlink count for the given domain.
  print Alexa::getBacklinkCount();

  // Returns Alexa's page load time info for the given domain.
  print Alexa::getPageLoadTime();

Alexa Traffic Graphs

<?php
  // Returns HTML code for the 'daily traffic trend'-graph.
  print Alexa::getTrafficGraph(1);

  // Returns HTML code for the 'daily pageviews (percent)'-graph.
  print Alexa::getTrafficGraph(2);

  // Returns HTML code for the 'daily pageviews per user'-graph.
  print Alexa::getTrafficGraph(3);

  // Returns HTML code for the 'time on site (in minutes)'-graph.
  print Alexa::getTrafficGraph(4);

  // Returns HTML code for the 'bounce rate (percent)'-graph.
  print Alexa::getTrafficGraph(5);

  // Returns HTML code for the 'search visits'-graph, using specific graph dimensions of 320*240 px.
  print Alexa::getTrafficGraph(6, 0, 320, 240);

SEOstats Google Methods

Google Toolbar PageRank

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

Google Pagespeed Service

<?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
  // 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
  // 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

<?php
  // The normalized 10-point MozRank score of the URL. 
  print Mozscape::getMozRank();
  
  // The raw MozRank score of the URL.
  print Mozscape::getMozRankRaw();
  
  // The number of links (equity or nonequity or not, internal or external) to the URL.
  print Mozscape::getLinkCount();
  
  // The number of external equity links to the URL (http://apiwiki.moz.com/glossary#equity).
  print Mozscape::getEquityLinkCount();
  
  // A normalized 100-point score representing the likelihood
  // of the URL to rank well in search engine results.  
  print Mozscape::getPageAuthority();
  
  // A normalized 100-point score representing the likelihood
  // of the root domain of the URL to rank well in search engine results.
  print Mozscape::getDomainAuthority();

SEOstats Open Site Explorer (by MOZ) Methods

<?php
  // Returns several metrics from Open Site Explorer (by MOZ)
  $ose = OpenSiteExplorer::getPageMetrics();

  // MOZ Domain-Authority Rank - Predicts this domain's ranking potential in the search engines 
  // based on an algorithmic combination of all link metrics.
  print "Domain-Authority:         " .
        $ose->domainAuthority->result . ' (' .      // Int - e.g 42
        $ose->domainAuthority->unit   . ') - ' .    // String - "/100"
        $ose->domainAuthority->descr  . PHP_EOL;    // String - Result value description

  // MOZ Page-Authority Rank - Predicts this page's ranking potential in the search engines 
  // based on an algorithmic combination of all link metrics.
  print "Page-Authority:           " .
        $ose->pageAuthority->result . ' (' .        // Int - e.g 48
        $ose->pageAuthority->unit   . ') - ' .      // String - "/100"
        $ose->pageAuthority->descr  . PHP_EOL;      // String - Result value description

  // Just-Discovered Inbound Links - Number of links to this page found over the past %n days, 
  // indexed within an hour of being shared on Twitter.
  print "Just-Discovered Links:    " .
        $ose->justDiscovered->result . ' (' .       // Int - e.g 140
        $ose->justDiscovered->unit   . ') - ' .     // String - e.g "32 days"
        $ose->justDiscovered->descr  . PHP_EOL;     // String - Result value description

  // Root-Domain Inbound Links - Number of unique root domains (e.g., *.example.com) 
  // containing at least one linking page to this URL.
  print "Linking Root Domains:     " .
        $ose->linkingRootDomains->result . ' (' .   // Int - e.g 210
        $ose->linkingRootDomains->unit   . ') - ' . // String - "Root Domains"
        $ose->linkingRootDomains->descr  . PHP_EOL; // String - Result value description

  // Total Links - All links to this page including internal, external, followed, and nofollowed.
  print "Total Links:              " .
        $ose->totalLinks->result . ' (' .           // Int - e.g 31571
        $ose->totalLinks->unit   . ') - ' .         // String - "Total Links"
        $ose->totalLinks->descr  . PHP_EOL;         // String - Result value description

SEOstats SEMRush Methods

SEMRush Domain Reports

<?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

<?php
  // Returns HTML code for the 'search engine traffic'-graph.
  print SemRush::getDomainGraph(1);

  // Returns HTML code for the 'search engine traffic price'-graph.
  print SemRush::getDomainGraph(2);

  // Returns HTML code for the 'number of adwords ads'-graph, using explicitly SEMRush's german database.
  print SemRush::getDomainGraph(3, 0, 'de');

  // Returns HTML code for the 'adwords traffic'-graph, using explicitly SEMRush's german database and
  // specific graph dimensions of 320*240 px.
  print SemRush::getDomainGraph(4, 0, 'de', 320, 240);

  // Returns HTML code for the 'adwords traffic price '-graph, using explicitly SEMRush's german database,
  // specific graph dimensions of 320*240 px and specific graph colors (black lines and red dots for data points).
  print SemRush::getDomainGraph(5, 0, 'de', 320, 240, '000000', 'ff0000');

SEOstats Sistrix Methods

Sistrix Visibility Index

<?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
  // Returns integer PlusOne count
  print Social::getGooglePlusShares();

Facebook Interactions

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

Twitter Mentions

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

Other Shares

<?php
  // Returns the total count of URL shares via Delicious
  print Social::getDeliciousShares();

  // Returns array of top ten delicious tags for a URL
  print_r ( Social::getDeliciousTopTags() );

  // Returns the total count of URL shares via Digg
  print Social::getDiggShares();

  // Returns the total count of URL shares via LinkedIn
  print Social::getLinkedInShares();

  // Returns shares, comments, clicks and reach for the given URL via Xing
  print_r( Social::getXingShares() );

  // Returns the total count of URL shares via Pinterest
  print Social::getPinterestShares();

  // Returns the total count of URL shares via StumbleUpon
  print Social::getStumbleUponShares();

  // Returns the total count of URL shares via VKontakte
  print Social::getVKontakteShares();

License

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

More Repositories

1

php-yt_downloader

PHP Class to download videos from YouTube.
PHP
292
star
2

php-webmaster-tools-downloads

PHP class to download website data from Google Webmaster Tools as CSV.
PHP
107
star
3

GWT_CrawlErrors-php

Download website crawl errors from Google Webmaster Tools as CSV.
PHP
38
star
4

Critroni-php

Win32/Critroni (CTB-Locker) - Web version
PHP
37
star
5

net.bexton.android.UsbMassStorageToggle

Android App: USB Mass Storage Hack (to use with ICS Ports that doesn't support UMS yet).
Java
25
star
6

material-design-resources

Resources for Google's Material Design
18
star
7

hlscast

Super simple interface to play network media streams (HLS / VOD / IPTV) on Chromecast.
HTML
16
star
8

vue-cookieconsent

Vue wrapper for the awesome `cookieconsent` library.
TypeScript
15
star
9

android-play-store-apk-downloader-crx

Chrome extension to download APKs from the Google Play Store directly from Desktop Browser to PC.
JavaScript
9
star
10

net.bexton.android.device_id

Simple app to display the Settings.Secure and the GSF device ID for any Android device.
7
star
11

animated-urls

Demo: https://eyecatchup.github.io/animated-urls/index.html
HTML
6
star
12

GWT_IndexStatus-php

Request website indexing status data from your Google Webmaster Tools account.
PHP
6
star
13

backbutton-detect-js

Mirror of Brooke Bryan's "Back Button Detection Object" (v1.0.1)
JavaScript
5
star
14

tweetbutton

A custom tweetbutton with tweet count
5
star
15

php-gwt-sitemapuploader

Submit unlimited sitemaps to Google Webmaster Tools at once - with just one single call: new GWT_SitemapsUpload($sitemaps);
PHP
5
star
16

md-jekyll

Status: WIP, to-be-released.
4
star
17

nicegist

A vanilla JavaScript gist.io replacement
JavaScript
3
star
18

dmail

Self-Destructing Email
JavaScript
3
star
19

gmail-bulkdelete-nodejs

Bulk delete Gmail messages, using the Gmail API.
JavaScript
2
star
20

make_aroma

Bash script to create an AROMA-Installer package off of an Android otapackage build.
2
star
21

dotfiles

My personal collection of dotfiles (mainly for Git and Bash)
Shell
2
star
22

CC_Service-php

PHP class to request compiled JavaScript source code from the Closure Compiler's RESTful Service API.
PHP
2
star
23

eyecatchup

1
star
24

ww-web

Weight-Watchers Web App for Windows Phone
1
star
25

Locky

CAUTION! DANGEROUS!
1
star
26

jira-scrum-poker

Java
1
star
27

GetGitStats

PHP
1
star
28

angular-draggable-toggle

Toggle buttons for AngularJS - leightweight, configurable as hell & support dragging across devices. Demos: http://goo.gl/9QuYKm
HTML
1
star
29

node-aaf-api

(Simple) NodeJS wrapper for the AAF GraphQL API.
JavaScript
1
star
30

corona-covid19-fallzahlen-deutschland

Fallzahlen zu COVID-19 in Deutschland - Live abgefragt von verschiedenen, oft zitierten Datenquellen
HTML
1
star
31

SuperSimpleSlideshow.js

(Super Simple) Fullscreen Background Image Slideshow; using JavaScript and CSS3.
JavaScript
1
star
32

aoe-html5slides

AOE branded HTML5 Slide Presentation Template. Demo:
JavaScript
1
star