After playing around with it for a bit more, I have found the solutiin:
<div x-data="{ rating: {{ $slot }} }">
<div class="flex items-center">
<template x-for="star in [1, 2, 3, 4, 5]" :key="star">
<template x-if="star <= rating">
<x-phosphor-star-fill class="w-4" />
</template>
</template>
<template x-for="star in [1, 2, 3, 4, 5]" :key="star">
<template x-if="rating === star - 0.5 || rating > star - 0.5 && star > rating">
<x-phosphor-star-half-fill class="w-4" />
</template>
</template>
<template x-for="star in [1, 2, 3, 4, 5]" :key="star">
<template x-if="star - 0.5 > rating && star > rating">
<x-phosphor-star-fill class="w-4 text-gray-300" />
</template>
</template>
</div>
</div>
There may be a better solution, but this one works as expected. If you a better way, please let me know.