承接 mrshanebarron/rating 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mrshanebarron/rating

最新稳定版本:v1.0.2

Composer 安装命令:

composer require mrshanebarron/rating

包简介

Star rating component for Laravel - supports Livewire and Vue

README 文档

README

A star rating component for Laravel applications. Supports interactive ratings and read-only display. Works with Livewire and Vue 3.

Installation

composer require mrshanebarron/rating

Livewire Usage

Basic Usage

<livewire:sb-rating wire:model="rating" />

Display Only (Read-only)

<livewire:sb-rating :value="4" :readonly="true" />

Different Max Stars

<livewire:sb-rating wire:model="rating" :max="10" />

Different Sizes

<livewire:sb-rating wire:model="rating" size="sm" />
<livewire:sb-rating wire:model="rating" size="md" />
<livewire:sb-rating wire:model="rating" size="lg" />

Different Colors

<livewire:sb-rating wire:model="rating" color="yellow" />
<livewire:sb-rating wire:model="rating" color="orange" />
<livewire:sb-rating wire:model="rating" color="red" />
<livewire:sb-rating wire:model="rating" color="blue" />

Livewire Props

Prop Type Default Description
wire:model number - Bound rating value
max number 5 Maximum stars
readonly boolean false Disable interaction
size string 'md' Size: sm, md, lg
color string 'yellow' Color theme

Vue 3 Usage

Setup

import { SbRating } from './vendor/sb-rating';
app.component('SbRating', SbRating);

Basic Usage

<template>
  <SbRating v-model="rating" />
  <p>You rated: {{ rating }} stars</p>
</template>

<script setup>
import { ref } from 'vue';
const rating = ref(0);
</script>

Read-only Display

<template>
  <SbRating :model-value="4.5" readonly />
</template>

Custom Max

<template>
  <!-- 10-star rating -->
  <SbRating v-model="rating" :max="10" />
</template>

Sizes

<template>
  <SbRating v-model="rating" size="sm" />  <!-- 16px stars -->
  <SbRating v-model="rating" size="md" />  <!-- 24px stars -->
  <SbRating v-model="rating" size="lg" />  <!-- 32px stars -->
</template>

Colors

<template>
  <SbRating v-model="rating" color="yellow" />
  <SbRating v-model="rating" color="orange" />
  <SbRating v-model="rating" color="red" />
  <SbRating v-model="rating" color="blue" />
</template>

Product Review Example

<template>
  <div class="space-y-4">
    <div>
      <label class="block text-sm font-medium mb-1">Your Rating</label>
      <SbRating v-model="review.rating" size="lg" />
    </div>

    <div>
      <label class="block text-sm font-medium mb-1">Review</label>
      <textarea v-model="review.comment" class="w-full border rounded p-2" />
    </div>

    <button @click="submitReview">Submit Review</button>
  </div>
</template>

<script setup>
import { ref } from 'vue';

const review = ref({
  rating: 0,
  comment: ''
});

const submitReview = () => {
  // Submit review
};
</script>

Average Rating Display

<template>
  <div class="flex items-center gap-2">
    <SbRating :model-value="Math.round(averageRating)" readonly />
    <span class="text-sm text-gray-600">
      {{ averageRating.toFixed(1) }} ({{ totalReviews }} reviews)
    </span>
  </div>
</template>

Vue Props

Prop Type Default Description
modelValue Number 0 Current rating (v-model)
max Number 5 Maximum number of stars
readonly Boolean false Prevent interaction
size String 'md' Star size: sm, md, lg
color String 'yellow' Fill color: yellow, orange, red, blue

Events

Event Payload Description
update:modelValue number Emitted when rating changes

Size Reference

Size Dimensions
sm 16x16px
md 24x24px
lg 32x32px

Color Options

Color Tailwind Class
yellow text-yellow-400
orange text-orange-400
red text-red-400
blue text-blue-400

Features

  • Interactive: Click to set rating
  • Read-only Mode: Display ratings without interaction
  • Hover Effects: Scale animation on hover
  • Customizable: Colors, sizes, max stars

Styling

Uses Tailwind CSS:

  • Filled stars use selected color
  • Empty stars are gray
  • Hover scale animation
  • Smooth transitions

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • Tailwind CSS 3.x

License

MIT License

mrshanebarron/rating 适用场景与选型建议

mrshanebarron/rating 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「review」 「Rating」 「stars」 「vue」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 mrshanebarron/rating 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 mrshanebarron/rating 我们能提供哪些服务?
定制开发 / 二次开发

基于 mrshanebarron/rating 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 12
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-14