PHPackages                             muffin/multiselect - 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. [Database &amp; ORM](/categories/database)
4. /
5. muffin/multiselect

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

muffin/multiselect
==================

Toggle, select or multiselect a database field based on a set of conditions

0.0.1(10y ago)2344MITPHPPHP &gt;=5.4.16

Since Nov 16Pushed 10y ago2 watchersCompare

[ Source](https://github.com/UseMuffin/Multiselect)[ Packagist](https://packagist.org/packages/muffin/multiselect)[ Docs](http://gintoniccms.com)[ RSS](/packages/muffin-multiselect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Multiselect
===========

[](#multiselect)

[![Build Status](https://camo.githubusercontent.com/28eb8938646dc4e4925ad0e571ab00f0708aa2e0c992b544f130708b221380fb/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5573654d756666696e2f6d756c746973656c6563742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/UseMuffin/multiselect)[![Coverage](https://camo.githubusercontent.com/dd6be7fc0e3fb732de3a49d8fa29ca22cb6eef3f0dd0e1b538d3f6c559e7c8ab/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f5573654d756666696e2f4d756c746973656c6563742e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/UseMuffin/Multiselect)[![Total Downloads](https://camo.githubusercontent.com/5d367bfd2427f9f79db6bd012777e5243003f693e429d8911ba33142740560b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d756666696e2f6d756c746973656c6563742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/muffin/multiselect)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

Toggle, select or multiselect a database field based on a set of conditions

Install
-------

[](#install)

Using [Composer](http://getcomposer.org):

```
composer require muffin/multiselect:1.0.x-dev

```

You then need to load the plugin. You can use the shell command:

```
bin/cake plugin load Muffin/Multiselect

```

or by manually adding statement shown below to your app's `config/bootstrap.php`:

```
Plugin::load('Muffin/Multiselect');
```

Usage
-----

[](#usage)

In a playlist, a single song can be play at the time. Whenever a song is marked as playing, all of the other songs are marked as not playing. for this we use the boolean field `playing`.

```
CREATE table songs(
    id int(10) unsigned NOT NULL auto_increment,
    title varchar(255) NOT NULL,
    playing tinyint(1) NOT NULL,
);

```

Load the behavior in your model `SongsTable.php`:

```
$this->addBehavior('Multiselect.Multiselect', ['playing']);

```

More complex use cases can be covered like the following. Where only 2 articles can be marked as `featured` at the time for the same author. When a third article is marked as featured, one of the 3 articles gets unfeatured. In this case, ordered by the least view count and by modification date.

```
$this->addBehavior('Multiselect.Multiselect', [
    'featured' => [
        'state' => true,
        'scope' => ['author_id'],
        'limit' => 2,
        'order' => [
            'view_count' => 'ASC',
            'modified' => 'ASC',
        ],
    ],
]);

```

Configuration
-------------

[](#configuration)

- `[field_name]` The name of the field used as select
- `state` Either mark the active field as `true` or `false`
- `scope` Selections can be grouped by fields defined here
- `limit` Maximum number of selected elements
- `order` Order in which to unselect fields when the limit is exceeded

Patches &amp; Features
----------------------

[](#patches--features)

- Fork
- Mod, fix
- Test - this is important, so it's not unintentionally broken
- Commit - do not mess with license, todo, version, etc. (if you do change any, bump them into commits of their own that I can ignore when I pull)
- Pull request - bonus point for topic branches

To ensure your PRs are considered for upstream, you MUST follow the [CakePHP coding standards](http://book.cakephp.org/3.0/en/contributing/cakephp-coding-conventions.html).

Bugs &amp; Feedback
-------------------

[](#bugs--feedback)

License
-------

[](#license)

Copyright (c) 2015, [Use Muffin](http://usemuffin.com) and licensed under [The MIT License](http://www.opensource.org/licenses/mit-license.php).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% 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 ~10 days

Total

2

Last Release

3816d ago

### Community

Maintainers

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

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

---

Top Contributors

[![phillaf](https://avatars.githubusercontent.com/u/1533572?v=4)](https://github.com/phillaf "phillaf (14 commits)")[![ycad0](https://avatars.githubusercontent.com/u/10876162?v=4)](https://github.com/ycad0 "ycad0 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/muffin-multiselect/health.svg)

```
[![Health](https://phpackages.com/badges/muffin-multiselect/health.svg)](https://phpackages.com/packages/muffin-multiselect)
```

###  Alternatives

[dereuromark/cakephp-databaselog

A CakePHP plugin for storing and viewing application logs in the database

44165.0k2](/packages/dereuromark-cakephp-databaselog)[pgbi/cakephp3-soft-delete

SoftDelete plugin for CakePHP

87291.9k](/packages/pgbi-cakephp3-soft-delete)[liqueurdetoile/cakephp-orm-json

Cakephp plugin to provide easy control over JSON type fields in database

1461.1k](/packages/liqueurdetoile-cakephp-orm-json)[snelg/cakephp-3-oracle

Oracle datasource for CakePHP 3

121.5k](/packages/snelg-cakephp-3-oracle)

PHPackages © 2026

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