https://github.com/onmotion/yii2-survey
Adds survey functionality to your Yii2 application
https://github.com/onmotion/yii2-survey
poll survey yii2-extension yii2-modules yii2-survey
Last synced: about 1 year ago
JSON representation
Adds survey functionality to your Yii2 application
- Host: GitHub
- URL: https://github.com/onmotion/yii2-survey
- Owner: onmotion
- Created: 2017-10-18T09:32:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-11-09T01:11:06.000Z (over 6 years ago)
- Last Synced: 2025-04-12T22:55:07.964Z (about 1 year ago)
- Topics: poll, survey, yii2-extension, yii2-modules, yii2-survey
- Language: PHP
- Size: 678 KB
- Stars: 14
- Watchers: 7
- Forks: 20
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Survey module for Yii2 application
--
[](https://packagist.org/packages/onmotion/yii2-survey)
[](https://packagist.org/packages/onmotion/yii2-survey)
[](https://packagist.org/packages/onmotion/yii2-survey)
[](https://packagist.org/packages/onmotion/yii2-survey)
>! Note: the module under active developing, so it may have vary errors and unstable work.
> Highly appreciate your PR.

Installation
--
* Just run:
composer require onmotion/yii2-survey
or add
"onmotion/yii2-survey": "*"
to the require section of your composer.json file.
* apply migration:
```sh
php yii migrate --migrationPath=@vendor/onmotion/yii2-survey/migrations
```
* Define module to your config:
```php
'modules' => [
//...
'survey' => [
'class' => '\onmotion\survey\Module',
'params' => [
'uploadsUrl' => 'http://advanced-frontend.lh/uploads/survey/', // full URL of the folder where the images will be uploaded.
// 'uploadsUrl' => '/uploads/survey/', // or for basic
'uploadsPath' => '@frontend/web/uploads/survey/', // absolute path to the folder where images will be saved.
],
// 'as access' => [
// 'class' => AccessControl::class,
// 'except' => ['default/done'],
// 'only' => ['default*'],
// 'rules' => [
// [
// 'allow' => true,
// 'roles' => ['survey'],
// ],
// ],
// ],
],
//...
]
```
don't forget change your own params.
Usage
--
If you are using the Yii basic template, you must manually define `$controllerNamespace` for module.
*onmotion\survey\controllers* - backend (admin/create/edit surveys)
*onmotion\survey\widgetControllers* - default (for widget)
Now go to `/survey` in your backend and create a survey.

After that you can select Survey entities and show it for user, for example:
```php
echo \onmotion\survey\Survey::widget([
'surveyId' => 1
]);
```

Admin:

