PHPackages                             hananils/kirby-choices - 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. hananils/kirby-choices

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

hananils/kirby-choices
======================

For any list field offering options in the blueprint, like select, multiselect or checkboxlist, Choices will load and return the readable text values for the keys stored in the content file. It works with static options directly set in the blueprint as well as dynamic ones loaded via query or api settings.

4.0.0(1y ago)18222[1 PRs](https://github.com/hananils/kirby-choices/pulls)MITPHPPHP ^8.2

Since Nov 16Pushed 1w ago3 watchersCompare

[ Source](https://github.com/hananils/kirby-choices)[ Packagist](https://packagist.org/packages/hananils/kirby-choices)[ Docs](https://kirby.hananils.de/plugins/choices)[ RSS](/packages/hananils-kirby-choices/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (8)Dependencies (2)Versions (6)Used By (0)

[![Kirby Choices](.github/title.png)](.github/title.png)

**Choices** is a plugin for [Kirby 3](https://getkirby.com) that provides methods to manage field `options` in the frontend. For any field – like select, multiselect or checkboxlist – that offers `options` settings in the blueprint, this plugin will load and return the readable text values for the keys stored in the content file. It works with static options directly set in the blueprint as well as dynamic ones loaded via `query` or `api` settings.

Note

Please check out the online documentation at [kirby.hananils.de/plugins/choices](https://kirby.hananils.de/plugins/choices) for further information.

Example
-------

[](#example)

### Field

[](#field)

```
fields:
    fruits:
        label: Fruits
        type: select
        options:
            apple: Apple
            pear: Pear
            banana: Banana
```

### Content

[](#content)

```
Title: Choices example

----

Fruits: apple, pear
```

### Template

[](#template)

```
// Return selected fruits: "Apple Pear"
foreach ($page->fruits()->toChoices() as $fruit) {
    echo $fruit;
}

// Return selected fruits in flipped order: "Pear Apple"
foreach (
    $page
        ->fruits()
        ->toChoices()
        ->flip()
    as $fruit
) {
    echo $fruit;
}
```

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

[](#installation)

### Download

[](#download)

Download and copy this repository to `/site/plugins/choices`.

### Git submodule

[](#git-submodule)

```
git submodule add https://github.com/hananils/kirby-choices.git site/plugins/choices

```

### Composer

[](#composer)

```
composer require hananils/kirby-choices

```

Field methods
=============

[](#field-methods)

toChoices()
-----------

[](#tochoices)

Converts the field value to a [Choices collection](#user-content-choices-collection) featuring the text values of the selected options:

```
$page->fruits()->toChoices();
```

If the method is passed an optional value of `true`, it will return text values for all options specified in the blueprint:

```
$page->fruits()->toChoices(true);
```

Choices collection
==================

[](#choices-collection)

The Choices collection can be used to loop over all given options and return their values. It offers all methods known to the [default Kirby collection](https://getkirby.com/docs/reference/objects/toolkit/collection) like `first()`, `last()`, `shuffle()`, `sort()` and the like. Additionally, it provides three methods to simplify content output:

join($separator)
----------------

[](#joinseparator)

The join method concatenates all field value by a given separator.

- **`$separator`:** optional separator, uses `, ` as default.

```
// Will return: Apple, Pear
$page
    ->fruits()
    ->toChoices()
    ->join();
```

If you want to have more control on how to join values – e. g. to have the last item joined by `and` – have a look at the [List methods plugin](https://github.com/hananils/kirby-list-methods).

missing($required)
------------------

[](#missingrequired)

The missing method compare the current field values with an array of required values and return the missing ones.

- **`$required`:** array of required values to be checked.

```
// Will return: Banana
$page
    ->fruits()
    ->toChoices()
    ->missing(['Apple', 'Banana']);
```

average($decimals)
------------------

[](#averagedecimals)

The average method will calculate the average of all selected value, useful when handling numeric values.

- **`$decimals`:** the number of decimals to return.

License
=======

[](#license)

This plugin is provided freely under the [MIT license](LICENSE.md) by [hana+nils · Büro für Gestaltung](https://hananils.de).
We create visual designs for digital and analog media.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance76

Regular maintenance activity

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 96.8% 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 ~329 days

Total

5

Last Release

374d ago

Major Versions

2.1.1 → 3.0.02023-02-08

3.0.1 → 4.0.02025-06-25

### Community

Maintainers

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

---

Top Contributors

[![nilshoerrmann](https://avatars.githubusercontent.com/u/25466?v=4)](https://github.com/nilshoerrmann "nilshoerrmann (30 commits)")[![SarahFdL](https://avatars.githubusercontent.com/u/74208327?v=4)](https://github.com/SarahFdL "SarahFdL (1 commits)")

###  Code Quality

Static AnalysisRector

### Embed Badge

![Health badge](/badges/hananils-kirby-choices/health.svg)

```
[![Health](https://phpackages.com/badges/hananils-kirby-choices/health.svg)](https://phpackages.com/packages/hananils-kirby-choices)
```

###  Alternatives

[himiklab/yii2-sortable-grid-view-widget

Sortable modification of standard Yii2 GridView widget

79361.2k7](/packages/himiklab-yii2-sortable-grid-view-widget)[nsavinov/nova-percent-field

A Laravel Nova field.

21280.0k](/packages/nsavinov-nova-percent-field)

PHPackages © 2026

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