No description or website provided.

RatingWidget PHP-SDK

API Authentication

Authentication is easy to do. The API will generate all the necessary URLs your application needs to authenticate.

To get your site's ID, Public Key & Secret Key, simply sign-in at and open the relevant site details.

// Use API site scope.
define('RW_SDK__API_SCOPE', 'site');

// Modify the following definitions to your site details.
define('RW_SDK__SITE_ID',         '__YOUR_SITE_ID__');

// Init API.
$rw_api = new \RatingWidget\Api\Sdk\RatingWidget(

Usage Example

Loading the first 100 site's ratings:

$ratings = $rw_api->Api('/ratings.json?fields=id,external_id,approved_count,avg_rate&count=100');

Note: Please do NOT use ratings.json call for Rich-Snippets, there's a special call for that.

Clear specified rating's votes:

$ratings = $rw_api->Api('/ratings/1234/votes.json', 'DELETE');

Rich-Snippets Data Fetching

Google crwaling frequency is not requiring a real-time micro data updates. Thus, we've wrapped the Rich-Snippets endpoint with special SDK methods that using local disk caching to prevent unnecessary API calls.

IMPORTANT: Thus, make sure the PHP script running the SDK has WRITE permissions to the parent directory of the SDK files.

To get specified ratings data use:

$rating_data = $rw_api->GetRichSnippetData($rating_id);

To echo AggregateRating HTML use:


You can use /src/example.html.php as an excellent implementation of Rich-Snippets support.

Reporting Bugs

Email dev [at] rating-widget [dot] com

FAQ and Knowledge Base