pushword/quiz 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

pushword/quiz

最新稳定版本:1.0.0-rc672

Composer 安装命令:

composer require pushword/quiz

包简介

Interactive client-side quizzes (QCM) for Pushword: a {{ quiz(...) }} Twig block, an EditorJS editor, anonymous percentile stats and an optional end-of-quiz conversion form.

README 文档

README

Interactive, (almost) server-less quizzes (QCM) for Pushword.

  • {{ quiz('…json…') }} Twig block — declare a quiz inline in a page. The payload is a JSON string (not a Twig hash) on purpose: Twig can never choke on its structure, so a malformed quiz degrades gracefully (admins see a detailed error panel, visitors see nothing) instead of 500-ing the page.
  • EditorJS block — add/remove questions and answers, flag the correct answer(s), attach an image or a video, write the explanation.
  • Progressive enhancement — the full quiz is rendered server-side as a readable, schema.org-tagged Q&A (great for SEO and no-JS); quiz.js turns it into a one-question-at-a-time game with immediate feedback and a score donut.
  • Anonymous percentilePOST /quiz/result stores a score (no PII) and returns "better than X% of participants".
  • Conversion form — set cta to a pushword/conversation form type to show a lead form at the end (pre-filled from a localStorage identity). Optional soft dependency.
  • POST /api/quiz/validate — token-authenticated endpoint (for AI agents) that validates a quiz payload and returns precise {path, message} violations.

Quiz JSON shape

{
  "title": "Montagnes du monde",
  "difficulty": "Facile",
  "feedback": "immediate",
  "cta": "newsletter",
  "questions": [
    {
      "q": "Quel est le plus haut sommet du monde ?",
      "media": "everest.jpg",
      "alt": "Le mont Everest",
      "answers": [
        { "a": "Mont Blanc" },
        { "a": "Everest", "correct": true },
        { "a": "K2" }
      ],
      "explanation": "Le mont Everest culmine à 8 849 mètres."
    }
  ],
  "results": [
    { "min": 0, "msg": "À retravailler !" },
    { "min": 80, "msg": "Bravo !" }
  ]
}

A question may carry an image (media) or a video (video); a video reuses the media image as its poster, so both media and an alt (accessibility) are required for one. The single source of truth for validity is the Quiz model + Symfony Validator, shared by the renderer, the editor lint and the API endpoint.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固