Search by

pushword / quiz

Robin D.

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.

Package info

github.com/Pushword/quiz

Homepage

Issues

Documentation

Type:symfony-bundle

pkg:composer/pushword/quiz

Fund package maintenance!

Liberapay

Statistics

Installs: 2 125

Dependents: 0

Suggesters: 19

Stars: 0

1.0.51 2026-10-10 11:37 UTC

This package is auto-updated.

Last update: 2026-10-11 20:41:19 UTC


README

Interactive quizzes (QCM) and personality tests for Pushword.

  • {% quiz %}{ …json… }{% endquiz %} block — declare a quiz inline in a page. The JSON is the raw tag body, so quotes need no escaping. The legacy {{ quiz('…json…') }} function still works (escape ' as \'). A malformed quiz shows admins an error panel and visitors nothing; a missing media file is skipped.
  • EditorJS block — knowledge quiz, difficulty levels or personality test, chosen from its Type selector.
  • Progressive enhancement — the quiz is rendered server-side as a readable, schema.org-tagged Q&A (SEO, no-JS); quiz.js turns it into a one-question-at-a-time game with feedback and a score donut.
  • Difficulty levels (levels) behind an accessible tab selector, and personality tests (mode: profile) where answers weigh named profiles.
  • Anonymous percentile — POST /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. Optional dependency.
  • Validation for agents — pw:quiz:validate <file|-> lints quiz blocks in a flat file or stdin; POST /api/quiz/validate does the same over the API. Both return {path, message} violations. pw:quiz:schema and GET /api/quiz/schema serve the payload's JSON Schema.
  • Results API — GET /api/quiz/result lists attempts; GET /api/quiz/result/stats tallies them per quiz.

Installation

composer require pushword/quiz
php bin/console doctrine:schema:update --force
php bin/console assets:install

Example

{
  "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 !" }
  ]
}

Documentation

Fields, levels, personality tests, styling and APIs: pushword.piedweb.com/extension/quiz.

License

MIT — see the license.