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
Canvas LMS
QTI-compatible XML. Import directly into Canvas via Settings → Import Course Content → QTI.
Output:
canvas_quiz.xmlMoodle
Moodle XML format with full HTML and LaTeX support. Import via Question bank → Import.
Output:
moodle_quiz.xmlD2L / Brightspace
D2L-specific XML with multiple choice questions and solution feedback. Import via Quizzes → Import.
Output:
d2l_quiz.xmlH5P
Interactive HTML5 quiz package with MathJax support, progress tracking, and retry controls.
Output:
quiz.h5pQTI 2.1
IMS QTI standard XML. Compatible with Blackboard, Sakai, and most modern LMS platforms.
Output:
qti_quiz.xmlHow to Export on This Site
- Generate a problem set using the Contest Generator or Topic Generator, or open a Saved Problem Set.
- Scroll to the Export to LMS row of buttons.
- Click the button for your target platform (Canvas, Moodle, D2L, H5P, or QTI).
- 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
- Multiple choice and numeric (fill-in-the-blank) question types.
- LaTeX / MathJax support for H5P and Moodle formats.
- Solution feedback included in all formats where supported.
- H5P output includes progress tracking, retry button, and solution reveal.
- QTI supports versions 1.2, 2.1, 2.2, and 3.0 via
setVersion(). - All generators extend Laravel's
Controllerfor easy route integration.
Requirements
- PHP 7.4 or higher.
ext-zipfor H5P package generation.ext-jsonfor JSON operations.- Laravel 9.x, 10.x, 11.x, or 12.x.