承接 ashokdubariya/module-testimonial 相关项目开发

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

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

ashokdubariya/module-testimonial

Composer 安装命令:

composer require ashokdubariya/module-testimonial

包简介

Magento 2 Testimonial Module with GraphQL API support and Hyvä Theme compatibility for managing customer testimonials with complete CRUD operations, admin panel, and frontend display.

README 文档

README

This repository contains a Testimonial module with GraphQL API support and Hyvä Theme compatibility for managing customer testimonials with complete CRUD operations, admin panel, and frontend display.

Key Features

  • Complete database schema with optimized indexes
  • Full Admin CRUD using Magento UI Components
  • Frontend testimonial listing and submission pages
  • GraphQL endpoints (queries & mutations)
  • Strong validation and security best practices
  • LESS-based styling following Magento 2 standards (Luma)
  • Hyvä theme compatible frontend (no RequireJS / no jQuery)
  • Repository pattern and service layer architecture

Requirements

  • Magento Open Source 2.4.5+
  • PHP 8.1+

Module Information

  • Module Name: Ashokdubariya_Testimonial
  • Package Name: ashokdubariya/module-testimonial
  • Module Type: Magento 2 Custom Module
  • API Type: GraphQL
  • License: MIT

Installation

Method 1: Composer Installation (Recommended)

composer require ashokdubariya/module-testimonial
php bin/magento module:enable Ashokdubariya_Testimonial
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

Method 2: Manual Installation

  1. Copy the module to Magento:
mkdir -p app/code/Ashokdubariya/Testimonial
# Copy module files to app/code/Ashokdubariya/Testimonial
  1. Run Magento commands:
php bin/magento module:enable Ashokdubariya_Testimonial
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento cache:flush

GraphQL Endpoint

After installation, the GraphQL endpoint is available at:

https://your-magento-site.com/graphql

GraphQL Schema Example

File: etc/schema.graphqls

Queries

1. Get All Testimonials (with Filtering & Pagination)

Basic Query

query {
  testimonials(currentPage: 1, pageSize: 10) {
    total_count
    items {
      testimonial_id
      customer_name
      customer_email
      message
      rating
      status
      created_at
      updated_at
    }
  }
}

With Filters - Filter by Status

query {
  testimonials(
    currentPage: 1
    pageSize: 10
    filter: {
      status: { eq: "1" }
    }
  ) {
    total_count
    items {
      testimonial_id
      customer_name
      message
      rating
      created_at
    }
  }
}

With Filters - Filter by Rating

query {
  testimonials(
    filter: {
      rating: { eq: "5" }
    }
  ) {
    total_count
    items {
      testimonial_id
      customer_name
      message
      rating
    }
  }
}

With Filters - Search by Name (LIKE)

query {
  testimonials(
    filter: {
      customer_name: { like: "John" }
    }
  ) {
    total_count
    items {
      testimonial_id
      customer_name
      message
    }
  }
}

With Filters - Multiple Ratings (IN)

query {
  testimonials(
    filter: {
      rating: { in: ["4", "5"] }
    }
  ) {
    total_count
    items {
      testimonial_id
      customer_name
      rating
    }
  }
}

With Filters - Date Range

query {
  testimonials(
    filter: {
      created_at: {
        from: "2026-01-01"
        to: "2026-01-31"
      }
    }
  ) {
    total_count
    items {
      testimonial_id
      customer_name
      created_at
    }
  }
}

With Filters - Combined Filters

query {
  testimonials(
    currentPage: 1
    pageSize: 20
    filter: {
      status: { eq: "1" }
      rating: { in: ["4", "5"] }
      customer_name: { like: "John" }
    }
  ) {
    total_count
    items {
      testimonial_id
      customer_name
      message
      rating
      status
      created_at
    }
  }
}

2. Get Testimonial by ID

query {
  testimonial(id: 5) {
    testimonial_id
    customer_name
    customer_email
    message
    rating
    status
    created_at
    updated_at
  }
}

Response

{
  "data": {
    "testimonial": {
      "testimonial_id": 5,
      "customer_name": "John Doe",
      "customer_email": "john@example.com",
      "message": "Excellent service!",
      "rating": 5,
      "status": 1,
      "created_at": "2026-01-06 15:00:00",
      "updated_at": "2026-01-06 16:30:00"
    }
  }
}

Mutations

3. Add Testimonial

mutation {
  addTestimonial(
    input: {
      customer_name: "John Doe"
      customer_email: "john@example.com"
      message: "Excellent service! Highly recommended."
      rating: 5
    }
  ) {
    testimonial_id
    status
    message
  }
}

Response

{
  "data": {
    "addTestimonial": {
      "testimonial_id": 6,
      "status": "success",
      "message": "Testimonial submitted successfully. It will be reviewed by our team."
    }
  }
}

4. Update Testimonial

Update one or more fields of an existing testimonial.

Update All Fields

mutation {
  updateTestimonial(
    id: 5
    input: {
      customer_name: "John Smith"
      customer_email: "john.smith@example.com"
      message: "Updated message - Still excellent!"
      rating: 5
      status: 1
    }
  ) {
    testimonial_id
    status
    message
    testimonial {
      testimonial_id
      customer_name
      customer_email
      message
      rating
      status
      updated_at
    }
  }
}

Update Specific Fields Only

mutation {
  updateTestimonial(
    id: 5
    input: {
      status: 1
    }
  ) {
    testimonial_id
    status
    message
    testimonial {
      testimonial_id
      status
      updated_at
    }
  }
}

Update Rating and Message

mutation {
  updateTestimonial(
    id: 5
    input: {
      message: "Updated testimonial message"
      rating: 4
    }
  ) {
    testimonial_id
    status
    message
  }
}

Response

{
  "data": {
    "updateTestimonial": {
      "testimonial_id": 5,
      "status": "success",
      "message": "Testimonial updated successfully.",
      "testimonial": {
        "testimonial_id": 5,
        "customer_name": "John Smith",
        "customer_email": "john.smith@example.com",
        "message": "Updated message - Still excellent!",
        "rating": 5,
        "status": 1,
        "updated_at": "2026-01-06 16:50:00"
      }
    }
  }
}

5. Delete Testimonial

mutation {
  deleteTestimonial(id: 5) {
    status
    message
  }
}

Response

{
  "data": {
    "deleteTestimonial": {
      "status": "success",
      "message": "Testimonial deleted successfully."
    }
  }
}

Error Response (Not Found)

{
  "errors": [
    {
      "message": "Testimonial with ID 999 not found.",
      "extensions": {
        "category": "graphql-no-such-entity"
      }
    }
  ]
}

Filter Options

Available Filter Fields

  • customer_name - Filter by customer name
  • customer_email - Filter by email
  • rating - Filter by rating (1-5)
  • status - Filter by status (0=Disabled, 1=Enabled)
  • created_at - Filter by creation date

Filter Types

Filter Type Description Example
eq Equal to { eq: "1" }
in In array { in: ["4", "5"] }
like Pattern match { like: "John" }
from Greater than or equal { from: "2026-01-01" }
to Less than or equal { to: "2026-01-31" }

cURL Examples

Get Filtered Testimonials

curl -X POST https://your-magento-site.com/graphql \
  -H "Content-Type: application/json" \
  -d '{
    "query": "query { testimonials(filter: { status: { eq: \"1\" }, rating: { in: [\"4\", \"5\"] } }) { total_count items { testimonial_id customer_name rating } } }"
  }'

Update Testimonial

curl -X POST https://your-magento-site.com/graphql \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation { updateTestimonial(id: 5, input: { status: 1 }) { testimonial_id status message } }"
  }'

Delete Testimonial

curl -X POST https://your-magento-site.com/graphql \
  -H "Content-Type: application/json" \
  -d '{
    "query": "mutation { deleteTestimonial(id: 5) { status message } }"
  }'

Common Use Cases

1. Get Only 5-Star Testimonials

query {
  testimonials(filter: { rating: { eq: "5" }, status: { eq: "1" } }) {
    items {
      customer_name
      message
      created_at
    }
  }
}

2. Get Recent Testimonials (Last 30 Days)

query {
  testimonials(
    filter: {
      created_at: { from: "2025-12-07" }
      status: { eq: "1" }
    }
  ) {
    items {
      customer_name
      message
      rating
      created_at
    }
  }
}

3. Search Testimonials by Customer Email

query {
  testimonials(filter: { customer_email: { like: "@example.com" } }) {
    items {
      testimonial_id
      customer_name
      customer_email
      message
    }
  }
}

4. Approve Testimonial (Change Status)

mutation {
  updateTestimonial(id: 10, input: { status: 1 }) {
    status
    message
    testimonial {
      testimonial_id
      status
    }
  }
}

5. Bulk Approve by Getting Disabled and Updating

# Step 1: Get disabled testimonials
query {
  testimonials(filter: { status: { eq: "0" } }) {
    items {
      testimonial_id
      customer_name
      message
    }
  }
}

# Step 2: Update each one
mutation {
  updateTestimonial(id: 10, input: { status: 1 }) {
    status
    message
  }
}

Validation Rules

Add/Update Testimonial

  • customer_name: Required (for add), max 255 characters
  • customer_email: Required (for add), valid email format, max 255 characters
  • message: Required (for add), no length limit
  • rating: Required (for add), integer 1-5
  • status: Optional, 0 or 1

Filter Values

  • All filter values should be strings (even numbers)
  • Date format: YYYY-MM-DD or YYYY-MM-DD HH:MM:SS
  • Use like for partial matches (automatically adds % wildcards)

Status Values

  • 0 = Disabled (default for customer submissions)
  • 1 = Enabled (visible in public queries)

Complete API Summary

Operation Type Description
testimonials Query Get paginated list with filtering
testimonial Query Get single testimonial by ID
addTestimonial Mutation Create new testimonial
updateTestimonial Mutation Update existing testimonial
deleteTestimonial Mutation Delete testimonial

Testing with GraphQL Playground

  1. Navigate to: https://your-magento-site.com/graphql
  2. Use the schema explorer to see all available fields
  3. Test queries and mutations interactively
  4. View auto-complete suggestions

Additional Resources

  • Admin Panel: /admin/testimonial/testimonial/index
  • Frontend Listing: /testimonial
  • Submit Form: /testimonial/submit
  • Module Location: /app/code/Ashokdubariya/Testimonial

Support

License

This project is licensed under the MIT License - see the LICENSE file for details.

ashokdubariya/module-testimonial 适用场景与选型建议

ashokdubariya/module-testimonial 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 01 月 15 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 ashokdubariya/module-testimonial 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-15