PHPackages                             wimando/laravel-survey - 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. wimando/laravel-survey

ActiveLibrary

wimando/laravel-survey
======================

Create surveys inside your Laravel app

v0.0.7(4y ago)218[1 issues](https://github.com/nelkasovic/laravel-survey/issues)MITPHPPHP ^7.4|^8.0

Since Sep 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/nelkasovic/laravel-survey)[ Packagist](https://packagist.org/packages/wimando/laravel-survey)[ RSS](/packages/wimando-laravel-survey/feed)WikiDiscussions main Synced yesterday

READMEChangelog (7)Dependencies (5)Versions (8)Used By (0)

Laravel Survey
==============

[](#laravel-survey)

Create and manage surveys within your Laravel app. I decided to fork this one `https://github.com/matt-daneshvar/laravel-survey` and modify to fit project needs.

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

[](#installation)

Require the package using composer.

```
composer require wimando/laravel-survey
```

Publish package migrations.

```
php artisan vendor:publish --provider="Wimando\Survey\SurveyServiceProvider" --tag="migrations"
```

Run the migrations to create all survey tables.

```
php artisan migrate
```

Usage
-----

[](#usage)

### Creating a Survey

[](#creating-a-survey)

Creating a new `Survey` is easy! You can build your survey fluently just like how you create all your `Eloquent` models in your app.

```
$survey = SurveyFactory::create(['name' => 'Cat Population Survey']);

$survey->save();

$survey->questions()->create([
     'content' => 'How many cats do you have?',
     'type' => 'number',
     'rules' => ['numeric', 'min:0']
 ]);

$survey->questions()->create([
    'content' => 'What\'s the name of your first cat',
]);

$survey->questions()->create([
    'content' => 'Would you want a new cat?',
    'type' => 'radio',
    'options' => ['Yes', 'Oui']
]);
```

#### Creating Multiple Sections

[](#creating-multiple-sections)

You may also park your questions under multiple sections.

```
$survey = SurveyFactory::create(['name' => 'Cat Population Survey']);

$survey->save();

$one = $survey->sections()->create(['name' => 'Part One']);

$one->questions()->create([
    'content' => 'How many cats do you have?',
    'type' => 'number',
    'rules' => ['numeric', 'min:0']
]);

$two = $survey->sections()->create(['name' => 'Part Two']);

$two->questions()->create([
    'content' => 'What\'s the name of your first cat?',
]);

$two->questions()->create([
    'content' => 'Would you want a new cat?',
    'type' => 'radio',
    'options' => ['Yes', 'Oui']
]);
```

### Creating an Entry

[](#creating-an-entry)

#### From an Array

[](#from-an-array)

The `Entry` model comes with a `fromArray` function.
This is especially useful when you're creating an entry from a form submission.

```
$entry = EntryFactory::create();

$entry->for($survey)->fromArray([
    'q1' => 'Yes',
    'q2' => 5
])->push();
```

#### By a Specific User

[](#by-a-specific-user)

You may fluently specify the participant using the `by()` function.

```
$entry = EntryFactory::create();

$entry->for($survey)->by($user)->fromArray($answers)->push();
```

### Setting Constraints

[](#setting-constraints)

When creating your survey, you may set some constraints to be enforced every time a new `Entry` is being created.

#### Allowing Guest Entries

[](#allowing-guest-entries)

By default, `Entry` models require a `participant_id` when being created. If you wish to change this behaviour and accept guest entries, set the `accept-guest-entries` option on your `Survey` model.

```
SurveyFactory::create(['settings' => ['accept-guest-entries' => true]]);
```

#### Adjusting Entries Per Participant Limit

[](#adjusting-entries-per-participant-limit)

All `Survey` models default to accept only **1 entry** per unique participant. You may adjust the `limit-per-participant` option on your `Survey` model or set it to `-1` to remove this limit altogether.

```
SurveyFactory::create(['settings' => ['limit-per-participant' => 1]]);
```

*Note that this setting will be ignored if the `accept-guest-entries` option is activated.*

### Validation

[](#validation)

#### Defining Validation Rules

[](#defining-validation-rules)

Add in a `rules` attribute when you're creating your `Question` to specify the validation logic for the answers being received.

```
QuestionFactory::create([
    'content' => 'How many cats do you have?',
    'rules' => ['numeric', 'min:0']
]);
```

*Note that as opposed to the survey constraints, the question validators are not automatically triggered during the entry creation process. To validate the answers, you should manually run the validation in your controller (see below)*

#### Validating Submissions

[](#validating-submissions)

Validate user's input against the entire rule set of your `Survey` using Laravel's built in validator.

```
class SurveyEntriesController extends Controller
{
    public function store(Survey $survey, Request $request)
    {
        $answers = $this->validate($request, $survey->rules);

        $entry = EntryFactory::create();

        $entry->for($survey)->fromArray($answers)->push();
    }
}
```

### Views

[](#views)

Out of the box this package comes with boilerplate Bootstrap 4.0 views to display the surveys and some basic question types. These views are meant to be used only as samples, and are not expected to replace your views in production. To display survey in a card, include the `card` partial in your views.

```
@include('survey::standard', ['survey' => $survey])
```

#### Customizing the Views

[](#customizing-the-views)

To customize the boilerplate views shipped with this package run `package:publish` with the `views` tag.

```
php artisan vendor:publish --provider="Wimando\Survey\SurveyServiceProvider" --tag="views"
```

This will create a new `vendor/wimando/survey` directory where you can fully customize the survey views to your liking.

### Road Map

[](#road-map)

- Allow configuration.
- Generalize participant relation in `Entry`.
- Add weight to options.
- Implement wizard + section pagination!
- Support anonymized entries.
- Add management dashboard.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~12 days

Recently: every ~17 days

Total

7

Last Release

1626d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1759407?v=4)[Nermin Elkasovic](/maintainers/nelkasovic)[@nelkasovic](https://github.com/nelkasovic)

---

Top Contributors

[![nelkasovic](https://avatars.githubusercontent.com/u/1759407?v=4)](https://github.com/nelkasovic "nelkasovic (9 commits)")

---

Tags

laravelsurvey

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wimando-laravel-survey/health.svg)

```
[![Health](https://phpackages.com/badges/wimando-laravel-survey/health.svg)](https://phpackages.com/packages/wimando-laravel-survey)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[matt-daneshvar/laravel-survey

Create surveys inside your Laravel app

28770.3k](/packages/matt-daneshvar-laravel-survey)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
