← Back to WaterlooBae

Laravel Quiz Converter

Export math problems to Canvas, Moodle, D2L, H5P, and QTI quiz formats.

GitHub Packagist

Overview

This package converts competition math problems into standardized quiz formats compatible with major LMS platforms. Each generator produces a ready-to-import file with multiple-choice questions, correct answer marking, and solution feedback where supported.

Supported Formats

FormatNotesOutput
Canvas LMSQTI-compatible XML. Import via Settings → Import Course Content → QTI.canvas_quiz.xml
MoodleMoodle XML format with full HTML and LaTeX support. Import via Question bank → Import.moodle_quiz.xml
D2L / BrightspaceD2L-specific XML with multiple choice questions and solution feedback. Import via Quizzes → Import.d2l_quiz.xml
H5PInteractive HTML5 quiz package with MathJax support, progress tracking, and retry controls.quiz.h5p
QTI 2.1IMS QTI standard XML. Compatible with Blackboard, Sakai, and most modern LMS platforms.qti_quiz.xml

How to Export on WaterlooBae Math

  1. Generate a problem set using the Contest Generator or Topic Generator, or open a Saved Problem Set.
  2. Scroll to the Export to LMS row of buttons.
  3. Click the button for your target platform (Canvas, Moodle, D2L, H5P, or QTI).
  4. The file downloads immediately. Import it into your LMS using the platform's standard quiz import flow.

Installation

Install via Composer:

composer require waterloobae/quizconverter

Laravel Routes

Register download routes in routes/web.php:

use Waterloobae\QuizConverter\CanvasQuizGenerator;
use Waterloobae\QuizConverter\MoodleQuizGenerator;
use Waterloobae\QuizConverter\D2LQuizGenerator;
use Waterloobae\QuizConverter\H5PQuizGenerator;
use Waterloobae\QuizConverter\QTIQuizGenerator;

Route::post('/quiz/canvas/download', function(Request $request) {
    $generator = new CanvasQuizGenerator();
    $generator->setQuestions($request->input('questions'));
    return $generator->download();
});

Route::post('/quiz/moodle/download', function(Request $request) {
    $generator = new MoodleQuizGenerator();
    $generator->setQuestions($request->input('questions'));
    return $generator->download();
});

Question Format

Canvas, D2L, and QTI use a simple array format:

$questions = [
    [
        'text'          => 'What is $2 + 2$?',
        'choices'       => ['3', '4', '5', '6'],
        'correct_index' => 1,
        'solution'      => '$2 + 2 = 4$.',
    ],
];

Moodle uses a named answers structure:

$questions = [
    [
        'type'     => 'multiple_choice',
        'question' => 'What is $2 + 2$?',
        'answers'  => [
            ['text' => '3', 'correct' => false],
            ['text' => '4', 'correct' => true],
            ['text' => '5', 'correct' => false],
        ],
        'solution' => '$2 + 2 = 4$.',
    ],
];

H5P uses the same structure as Moodle but with a text key instead of question:

$questions = [
    [
        'type'     => 'multiple_choice',
        'text'     => 'What is $2 + 2$?',
        'choices'  => [
            ['text' => '3', 'correct' => false],
            ['text' => '4', 'correct' => true],
        ],
        'solution' => '$2 + 2 = 4$.',
    ],
];

Key Features

Requirements