PHPackages                             fgh151/yii2-quiz - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fgh151/yii2-quiz

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

fgh151/yii2-quiz
================

Provide quiz algorithms

0124PHPCI passing

Since Jan 6Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/fgh151/yii2-quiz)[ Packagist](https://packagist.org/packages/fgh151/yii2-quiz)[ RSS](/packages/fgh151-yii2-quiz/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 quiz extemsion
===================

[](#yii2-quiz-extemsion)

Provide quiz algorithms

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](https://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist fgh151/yii2-quiz "*"

```

or add

```
"fgh151/yii2-quiz": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Example controller

```
public function actionUpdate($id)
    {
        $quiz = Quiz::findOne($id);

        if (Yii::$app->request->post()) {
            $quiz->initializeQuiz();
        }

        return $this->render('create', [
            'quiz' => $quiz,
            'questions' => empty($quiz->data) ? [new QuizQuestion()] : $quiz->data,
        ]);
    }
```

Example view, using [Dynamic form](https://github.com/fgh151/yii2-dynamicform)

```
