use something like this
https://www.w3schools.com/howto/howto_css_star_rating.asp
and iterate over it with a simple php loop
You are going to struggle to represent fractions though as that is a lot harder from the html/css point of view
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Whats the best way to do this and how would i do this? i'm looking to change my average rating number to stars instead of just displaying the average rating out of five. for example if the average rating returned is 3.27 then 3.27 stars will show. Is font awesome the easiest way and how would i incorporate that with the code below?
<h2>Rated : {{number_format($product->reviews->avg('ratings'),2)}} /5</h2>
Revised version using Fontawesome Stack feature;
@php $rating = 1.6; @endphp
@foreach(range(1,5) as $i)
<span class="fa-stack" style="width:1em">
<i class="far fa-star fa-stack-1x"></i>
@if($rating >0)
@if($rating >0.5)
<i class="fas fa-star fa-stack-1x"></i>
@else
<i class="fas fa-star-half fa-stack-1x"></i>
@endif
@endif
@php $rating--; @endphp
</span>
@endforeach
It looks more complicated than it is, but has to loop over all 5 stars and then decide if the stacked icon should be half or full.

This version does not have a problem being tied to the line height like the overlay version
Please or to participate in this conversation.