SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.
SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.
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.
SEOstats requires PHP version 5.3 or greater and the PHP5-CURL and PHP5-JSON extensions.
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.
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 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).
There're two configuration files to note:
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
// 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.
……<?php
// Returns the Google PageRank for the given URL.
print Google::getPageRank();<?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();<?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');<?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) );……<?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') );…<?php
// Returns the Sistrix visibility index
// @link http://www.sistrix.com/blog/870-sistrix-visibilityindex.html
print Sistrix::getVisibilityIndex();<?php
// Returns integer PlusOne count
print Social::getGooglePlusShares();<?php
// Returns an array of total counts for overall Facebook interactions count, shares, likes, comments and clicks.
print_r ( Social::getFacebookShares() );<?php
// Returns integer tweet count for URL mentions
print Social::getTwitterShares();…(c) 2010 - 2016, Stephan Schmitz [email protected]
License: MIT, http://eyecatchup.mit-license.org
URL: https://eyecatchup.github.io
No open issues yet, or sync has not completed.