PHP Classes

Star rating package: Process and show rating stars given by the user

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 60%Total: 1,571 All time: 2,506 This week: 455Up
Version License PHP version Categories
rating-package 1.0.0GNU General Publi...5.1PHP 5, Databases, Content management, A...


This class can be used to process and display rating stars given by the user to site content.

It can generate HTML and Javascript to let the user rate site content.

When the user rates content an AJAX request using Iframe is sent to the server to avoid page reloading.

The class updates the content ratings stored in a MySQL database and renders updated content ratings as response to the AJAX request.

Picture of akash
Name: akash <contact>
Classes: 3 packages by
Country: India India
Age: ???
All time rank: 96457 in India India
Week rank: 214 Up20 in India India Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x


What is the best PHP star rating class?
I would like PHP star rating script


= $_POST['itemId'];
$rating = $_POST['rating'];

$status = RatingManager::saveRating($itemID, $rating);

if (
$status === false) {
<script type="text/javascript">
function bodyLoaded() {
    if (!parent.document.getElementById('itemRating_<?php print $itemID; ?>')) {
    parent.document.getElementById('itemRating_<?php print $itemID; ?>').innerHTML = document.getElementById('bodyContainer').innerHTML;
    document.getElementById('bodyContainer').innerHTML = '';

<body onLoad="return bodyLoaded();" id="bodyContainer">
::drawItemRating($itemID, false);

  Files folder image Files  
File Role Description
Files folder imageimages (3 files)
Accessible without login Plain text file javascript.php Aux. includes javascript to the code and downloads the images required
Plain text file RatingManager.php Class PHP class which handles all the code and the requests
Accessible without login Plain text file set-item-rating.php Example Page used to save the rating for item
Accessible without login Plain text file sql.txt Data Rating table used for the rating system. Create this table in any database and rename the table name. Make the respective changes in the RatingManager.php constants also
Accessible without login Plain text file test.php Example Example page, run this page to test the functionality

  Files folder image Files  /  images  
File Role Description
  Accessible without login Image file star1.gif Icon Star image
  Accessible without login Image file star2.gif Icon Star image
  Accessible without login Image file star3.gif Icon Star image

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:2,506
This week:455Up
 User Ratings  
 All time