PHPackages                             macrominds/laravel-choice - 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. macrominds/laravel-choice

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

macrominds/laravel-choice
=========================

A modal choice dialogue for laravel

0.1.1(9y ago)5431MITPHPPHP ^7.0

Since Oct 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/macrominds/laravel-choice)[ Packagist](https://packagist.org/packages/macrominds/laravel-choice)[ RSS](/packages/macrominds-laravel-choice/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Modal user choice dialogue for laravel
======================================

[](#modal-user-choice-dialogue-for-laravel)

If you have an action that needs to be confirmed before proceeding, or you want to let the user choose from multiple options, then this solution might just be exactly what you are looking for.

Example
-------

[](#example)

The user has chosen to delete a person. That means that all upcoming events, hosted by this person, need to be canceled. But you don't want to cancel them silently. You want to be polite and ask the user first:

[![Screenshot of a modal choice dialogue implemented with macrominds/laravel-choice](https://camo.githubusercontent.com/323ab9dfe6d02f23d3a0bffcf3499693f6a1d00cf759d3790cd179b8cf79f9d7/687474703a2f2f7777772e6d6163726f6d696e64732e64652f696d616765732f6769746875622f6d6163726f6d696e64732d6c61726176656c2d63686f6963652e706e67)](https://camo.githubusercontent.com/323ab9dfe6d02f23d3a0bffcf3499693f6a1d00cf759d3790cd179b8cf79f9d7/687474703a2f2f7777772e6d6163726f6d696e64732e64652f696d616765732f6769746875622f6d6163726f6d696e64732d6c61726176656c2d63686f6963652e706e67)

Simply return the Choice where you would normally return the `redirect()` in your Controller.

```
return Choice::make(
    'Deleting the person will cancel some events',
    sprintf(
        '%s events are going to be canceled if you delete %s',
        $numEvents, $personName
    ),
    [
        Option::makeCancel('Cancel deletion'),
        Option::make(
            'Delete person and cancel events',
            route('customer.force-destroy', ['person' => $person]),
            'DELETE',
            [],
            true),
    ]
);

```

Depending on the choice of the user, she will be redirected either back to the previous page (standard `Option::makeCancel` behaviour) or to any route of your liking. You are **not limited** to two options.

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

[](#installation)

`composer require macrominds/laravel-choice`.

Usage
-----

[](#usage)

You should call `php artisan vendor:publish --tag=laravel-choice`.

This will add the customizable views to `resources/views/vendor/choice/*` and the minimalistic styling `resources/assets/sass/vendor/choice/_choice.scss` to your project. You should `@import "vendor/choice/choice";` in your `app.scss` afterwards.

In your master blade view, below all visible page elements, just before the end of your `` or just before the ``s at the bottom, add the following line:

```
{{ macrominds\laravel\choice\Choice::render() }}

```

Next? Nothing. You are ready to go. Just replace a `return redirect()` statement in your Controller with `return Choice::make (//...`.

TODO
----

[](#todo)

- Add some documentation
- Make php5.6 compatible

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

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 ~187 days

Total

2

Last Release

3308d ago

### Community

Maintainers

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

---

Top Contributors

[![tpraxl](https://avatars.githubusercontent.com/u/913720?v=4)](https://github.com/tpraxl "tpraxl (11 commits)")

---

Tags

laravelmodaldialoguechoice

### Embed Badge

![Health badge](/badges/macrominds-laravel-choice/health.svg)

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

###  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)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

88103.7k](/packages/emargareten-inertia-modal)[webfactor/laravel-backpack-instant-fields

Instant fields to create/edit/delete related entities on the fly in Laravel Backpack

486.9k](/packages/webfactor-laravel-backpack-instant-fields)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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