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

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

jangraviren/laravel-survey
==========================

Original credits goes to mceaser/laravel-survey.

v1.1.5(7y ago)118MITPHPPHP &gt;=7.0

Since Feb 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/jangraviren/laravel-survey)[ Packagist](https://packagist.org/packages/jangraviren/laravel-survey)[ Docs](https://github.com/jangraviren/laravel-survey)[ RSS](/packages/jangraviren-laravel-survey/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (5)Dependencies (1)Versions (9)Used By (0)

Original Credits
================

[](#original-credits)

```
Goes to mceaser/laravel-survey
Just made this package to use in 5.7.* version.

```

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/e26cf4cec6875ff4703a8272172e74617e4c25c1df44ff2ae083b5613549376d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a616e677261766972656e2f6c61726176656c2d7375727665792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jangraviren/laravel-survey)[![Build Status](https://camo.githubusercontent.com/258ea4ca413bd6426e735086f33268247f8fdb87c10a92ac4bc2ab5f3625355a/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a616e677261766972656e2f6c61726176656c2d7375727665792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jangraviren/laravel-survey)[![Total Downloads](https://camo.githubusercontent.com/8c731e4cb5a73d572864203360906381a87d969d223f51f22516d31e9126cdcf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a616e677261766972656e2f6c61726176656c2d7375727665792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jangraviren/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 jangraviren/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' => [
    // ...
    JangraViren\Survey\SurveyServiceProvider::class,
];
```

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

```
php artisan vendor:publish --provider="JangraViren\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="JangraViren\Survey\SurveyServiceProvider" --tag="config"
```

When published, [the `config/survey.php` config file](https://github.com/jangraviren/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
         * `JangraViren\Survey\Contracts\Category` contract.
         */

        'category' => JangraViren\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
         * `JangraViren\Survey\Question\Category` contract.
         */

        'question' => JangraViren\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
         * `JangraViren\Survey\Question\Answer` contract.
         */

        'answer' => JangraViren\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 jangraviren/laravel-survey
```

Copy the required files:

```
cp vendor/jangraviren/laravel-survey/config/permission.php config/survey.php
cp vendor/jangraviren/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(JangraViren\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 `JangraViren\Survey\Models\Category` model
- Your `Question` model needs to extend the `JangraViren\Survey\Models\Question` model
- Your `Answer` model needs to extend the `JangraViren\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 `JangraViren\Survey\Contracts\Category` contract
- Your `Question` model needs to implement the `JangraViren\Survey\Contracts\Question` contract
- Your `Answer` model needs to implement the `JangraViren\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="JangraViren\Survey\SurveyServiceProvider" --tag="config"
```

### Testing

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Virender Jangra](https://github.com/jangraviren)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 55.6% 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 ~61 days

Recently: every ~0 days

Total

7

Last Release

2684d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/94cbba9eedaa2a508ffbc4337a08be872c3be3cf6908a28ced5f8b6a5be19e8b?d=identicon)[jangraviren](/maintainers/jangraviren)

---

Top Contributors

[![milo526](https://avatars.githubusercontent.com/u/5261909?v=4)](https://github.com/milo526 "milo526 (15 commits)")[![VirenderKumarH3U](https://avatars.githubusercontent.com/u/26321330?v=4)](https://github.com/VirenderKumarH3U "VirenderKumarH3U (7 commits)")[![jangraviren](https://avatars.githubusercontent.com/u/4818068?v=4)](https://github.com/jangraviren "jangraviren (5 commits)")

---

Tags

laravelquestionsurveyanswer

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[matt-daneshvar/laravel-survey

Create surveys inside your Laravel app

28877.2k](/packages/matt-daneshvar-laravel-survey)[tapp/filament-survey

Filament Laravel Survey plugin.

3220.6k](/packages/tapp-filament-survey)[tapp/filament-form-builder

User facing form builder using Filament components

141.9k2](/packages/tapp-filament-form-builder)

PHPackages © 2026

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