PHP code example of hypejunction / elgg_stars

1. Go to this page and download the library: Download hypejunction/elgg_stars library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hypejunction / elgg_stars example snippets


echo elgg_view_form('stars/rate', [], [
    'entity' => $entity,
    'annotation_names' => ['starrating'],
]);

echo elgg_view('output/stars', ['value' => $entity_rating]);

$rating = elgg_stars_get_entity_rating_values($entity, ['starrating']);
// $rating = ['count' => N, 'sum' => N, 'value' => avg, 'min' => 0, 'max' => 5, 'step' => 1]