PHPackages                             mcesar/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mcesar/laravel-survey

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

mcesar/laravel-survey
=====================

Survey package for Laravel 5.5 and up

1.1.2(6y ago)171.7k10[2 issues](https://github.com/milo526/laravel-survey/issues)MITPHPPHP &gt;=7.0

Since Feb 15Pushed 6y agoCompare

[ Source](https://github.com/milo526/laravel-survey)[ Packagist](https://packagist.org/packages/mcesar/laravel-survey)[ Docs](https://github.com/milo526/laravel-survey)[ RSS](/packages/mcesar-laravel-survey/feed)WikiDiscussions master Synced yesterday

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

Add question to your Laravel application
========================================

[](#add-question-to-your-laravel-application)

[![Latest Version on Packagist](https://camo.githubusercontent.com/18f531139736e9c9d4fd3df30f7d9c614d2ebe55d32f1bc11b89965d691c32fc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d63657361722f6c61726176656c2d7375727665792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mcesar/laravel-survey)[![Build Status](https://camo.githubusercontent.com/b4a3683f9a0dc577e44b670085f8e3035cd10b384f9f0d3d3b3fb7ad1bb7441a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6d696c6f3532362f6c61726176656c2d7375727665792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/milo526/laravel-survey)[![Total Downloads](https://camo.githubusercontent.com/689872ecc96d0b473532bc469ddc7ba856e86cc1889181fb42ccd7d9a6275df7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d63657361722f6c61726176656c2d7375727665792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mcesar/laravel-survey)

- [Installation](#installation)
- [Usage](#usage)
- [Extending](#extending)

This package allows you to add a survey to your Laravel application

Once installed you can do stuff like this:

```
// Get all question that a user has
Question::answered(false)->get()
```

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

[](#installation)

- [Laravel](#laravel)
- [Lumen](#lumen)

### Laravel

[](#laravel)

This package can be used in Laravel 5.4 or higher. If you are using an older version of Laravel You can install the package via composer:

```
composer require mcesar/laravel-survey
```

In Laravel 5.5 the service provider will automatically get registered. In older versions of the framework just add the service provider in `config/app.php` file:

```
'providers' => [
    // ...
    MCesar\Survey\SurveyServiceProvider::class,
];
```

You can publish [the migration](https://github.com/milo526/laravel-survey/blob/master/database/migrations/create_survey_tables.php.stub) with:

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

After the migration has been published you can create the category-, question- and answer-tables by running the migrations:

```
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="MCesar\Survey\SurveyServiceProvider" --tag="config"
```

When published, [the `config/survey.php` config file](https://github.com/mcesar/laravel-survey/blob/master/config/survey.php) contains:

```
return [

    'models' => [

        /*
         * We need to know which Eloquent model should be used to retrieve your categories.
         * Of course, it is often just the "Category" model but you may use whatever you like.
         *
         * The model you want to use as a Category model needs to implement the
         * `MCesar\Survey\Contracts\Category` contract.
         */

        'category' => MCesar\Survey\Models\Category::class,

        /*
         * We need to know which Eloquent model should be used to retrieve your questions.
         * Of course, it is often just the "Question" model but you may use whatever you like.
         *
         * The model you want to use as a Question model needs to implement the
         * `MCesar\Survey\Question\Category` contract.
         */

        'question' => MCesar\Survey\Models\Question::class,

        /*
         * We need to know which Eloquent model should be used to retrieve your answers.
         * Of course, it is often just the "Answer" model but you may use whatever you like.
         *
         * The model you want to use as a Answer model needs to implement the
         * `MCesar\Survey\Question\Answer` contract.
         */

        'answer' => MCesar\Survey\Models\Answer::class,

        /*
         * We need to know which Eloquent model should be used to assign the answers to.
         * Of course, it is often just the "User" model but you may use whatever you like.
         */

        'user' => App\User::class,

    ],
];
```

### Lumen

[](#lumen)

> Lumen support is not tested!

You can install the package via Composer:

```
composer require mcesar/laravel-survey
```

Copy the required files:

```
cp vendor/mcesar/laravel-survey/config/permission.php config/survey.php
cp vendor/mcesar/laravel-survey/database/migrations/create_survey_tables.php.stub database/migrations/2018_01_01_000000_create_survey_tables.php
```

Now, run your migrations:

```
php artisan migrate
```

Then, register the configuration and the service provider:

```
$app->configure('survey');
$app->register(MCesar\Survey\SurveyServiceProvider::class);
```

Usage
-----

[](#usage)

The models supplied by this package can be used the same as any other model you make.

Extending
---------

[](#extending)

If you need to EXTEND the existing models note that:

- Your `Category` model needs to extend the `MCesar\Survey\Models\Category` model
- Your `Question` model needs to extend the `MCesar\Survey\Models\Question` model
- Your `Answer` model needs to extend the `MCesar\Survey\Models\Answer` model

If you need to REPLACE the existing models you need to keep the following things in mind:

- Your `Category` model needs to implement the `MCesar\Survey\Contracts\Category` contract
- Your `Question` model needs to implement the `MCesar\Survey\Contracts\Question` contract
- Your `Answer` model needs to implement the `MCesar\Survey\Contracts\Answer` contract

In BOTH cases, whether extending or replacing, you will need to specify your new models in the configuration. To do this you must update the `models.categorie`, `models.question` and `models.answer` values in the configuration file after publishing the configuration with this command:

```
php artisan vendor:publish --provider="MCesar\Survey\SurveyServiceProvider" --tag="config"
```

### Testing

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Milo Cesar](https://github.com/milo526)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 84.2% 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 ~160 days

Total

4

Last Release

2526d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a8859942581cc6c4417e71266e16f67d931e52f1bbe4a61a389211bf485564b1?d=identicon)[mcesar](/maintainers/mcesar)

---

Top Contributors

[![milo526](https://avatars.githubusercontent.com/u/5261909?v=4)](https://github.com/milo526 "milo526 (16 commits)")[![owenvoke](https://avatars.githubusercontent.com/u/1899334?v=4)](https://github.com/owenvoke "owenvoke (2 commits)")[![tysonlist](https://avatars.githubusercontent.com/u/3150363?v=4)](https://github.com/tysonlist "tysonlist (1 commits)")

---

Tags

laravelphpsurveylaravelquestionsurveyanswer

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/mcesar-laravel-survey/health.svg)](https://phpackages.com/packages/mcesar-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)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)[tapp/filament-form-builder

User facing form builder using Filament components

131.2k1](/packages/tapp-filament-form-builder)

PHPackages © 2026

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