Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/eyecatchup/SEOstats

SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.
https://github.com/eyecatchup/SEOstats

Last synced: 2 months ago
JSON representation

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

Lists

README

        

# SEOstats: SEO metrics library for PHP

[![License](https://poser.pugx.org/seostats/seostats/license "SEOstats is licensed under the M.I.T.")](https://github.com/eyecatchup/SEOstats) [![Scrutinizer Code Quality Rating](https://scrutinizer-ci.com/g/eyecatchup/SEOstats/badges/quality-score.png?b=master "Scrutinizer Code Quality Rating: Very Good!")](https://scrutinizer-ci.com/g/eyecatchup/SEOstats/ "'Very good' code quality, says Scrutinizer C.I.") [![Build Status](https://travis-ci.org/eyecatchup/SEOstats.svg?branch=master "Travis C.I. Build Status")](https://travis-ci.org/eyecatchup/SEOstats) [![Scrutinizer Test Coverage Report](https://scrutinizer-ci.com/g/eyecatchup/SEOstats/badges/coverage.png?b=master "Scrutinizer Test Coverage Report")](https://scrutinizer-ci.com/g/eyecatchup/SEOstats/code-structure/master?elementType=class&orderField=test_coverage&order=desc&changesExpanded=0 "Test coverage report by Scrutinizer C.I.") [![Latest Stable Version](https://poser.pugx.org/seostats/seostats/v/stable "Latest Stable Version")](https://packagist.org/packages/seostats/seostats) [![Latest Unstable Version](https://poser.pugx.org/seostats/seostats/v/unstable "Latest Unstable Version")](https://packagist.org/packages/seostats/seostats) [![Monthly Downloads](https://poser.pugx.org/seostats/seostats/d/monthly "That many people downloaded SEOstats from Github or Packagist this month.")](https://packagist.org/packages/seostats/seostats)

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](http://getcomposer.org).
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
```



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

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

```php
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
getMessage());
}
```

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


## SEOstats Alexa Methods

### Alexa Traffic Metrics
```php

## SEOstats Google Methods

### Google Toolbar PageRank

```php

## SEOstats Mozscape Methods

```php

## SEOstats Open Site Explorer (by MOZ) Methods

```php
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

## SEOstats Sistrix Methods

### Sistrix Visibility Index

```php

## SEOstats Social Media Methods

### Google+ PlusOnes

```php

## License

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