PHPackages                             liyunfang/yii2-contextmenu - 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. liyunfang/yii2-contextmenu

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

liyunfang/yii2-contextmenu
==========================

yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

1.0.5(10y ago)2432.4k↓49.3%10[1 PRs](https://github.com/pgyf/yii2-contextmenu/pulls)1MITPHP

Since Aug 20Pushed 6y ago5 watchersCompare

[ Source](https://github.com/pgyf/yii2-contextmenu)[ Packagist](https://packagist.org/packages/liyunfang/yii2-contextmenu)[ Docs](https://github.com/liyunfang/yii2-contextmenu)[ RSS](/packages/liyunfang-yii2-contextmenu/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (2)Versions (6)Used By (1)

yii2-contextmenu
================

[](#yii2-contextmenu)

yii2 Extended for bootstrap-contextmenu
=======================================

[](#yii2-extended-for-bootstrap-contextmenu)

yii2 Extended for bootstrap-contextmenu plugin

Gird right - click operation, you can remove the operation column

[![Effect picture 1](https://github.com/liyunfang/wr/raw/master/images/yii2-contextmenu-1.png "Effect picture 1")](https://github.com/liyunfang/wr/blob/master/images/yii2-contextmenu-1.png)

[![Effect picture 2](https://github.com/liyunfang/wr/raw/master/images/yii2-contextmenu-2.png "Effect picture 2")](https://github.com/liyunfang/wr/blob/master/images/yii2-contextmenu-2.png)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
 composer require --prefer-dist liyunfang/yii2-contextmenu

```

or add

```
"liyunfang/yii2-contextmenu": "*"

```

to the require section of your `composer.json` file.

Requirements
------------

[](#requirements)

This extension require twitter-bootstrap

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

GridView options

```
 'columns' => [
    [
        'class' => \liyunfang\contextmenu\SerialColumn::className(),
        'contextMenu' => true,
        //'contextMenuAttribute' => 'id',
        'template' => '{view} {update}  {story}',
        'buttons' => [
             'story' => function ($url, $model) {
                 $title = Yii::t('app', 'Story');
                 $label = ' ' . $title;
                 $url = \Yii::$app->getUrlManager()->createUrl(['/user/story','id' => $model->id]);
                 $options = ['tabindex' => '-1','title' => $title, 'data' => ['pjax' => '0' ,  'toggle' => 'tooltip']];
                 return '' . Html::a($label, $url, $options) . '' . PHP_EOL;
              }
         ],
   ],
    ....
],
'rowOptions' => function($model, $key, $index, $gird){
     $contextMenuId = $gird->columns[0]->contextMenuId;
     return ['data'=>[ 'toggle' => 'context','target'=> "#".$contextMenuId ]];
 },
```

or use KartikSerialColumn,But this requires the installation of grid Kartik extension. Please see

GridView options

```
 'columns' => [
    [
        'class' => \liyunfang\contextmenu\KartikSerialColumn::className(),
        'contextMenu' => true,
        //'contextMenuAttribute' => 'id',
        //'template' => '{view} {update}',
        'contentOptions'=>['class'=>'kartik-sheet-style'],
        'headerOptions'=>['class'=>'kartik-sheet-style'],
        'urlCreator' => function($action, $model, $key, $index) {
                if('update' == $action){
                    return \Yii::$app->getUrlManager()->createUrl(['/user/index','id' => $model->id]);
                }
                if('view' == $action){
                    return \Yii::$app->getUrlManager()->createUrl(['/user/view','id' => $model->id]);
                }
                return '#';
        },
   ],
    ....
],
'rowOptions' => function($model, $key, $index, $gird){
     $contextMenuId = $gird->columns[0]->contextMenuId;
     return ['data'=>[ 'toggle' => 'context','target'=> "#".$contextMenuId ]];
 },
```

该扩展为gird行右击菜单，可以省去操作列。 提供了继承yii2 grid的SerialColumn 和 继承 Kartik gird的SerialColumn。

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

5

Last Release

3889d ago

### Community

Maintainers

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

---

Top Contributors

[![pgyf](https://avatars.githubusercontent.com/u/3365344?v=4)](https://github.com/pgyf "pgyf (32 commits)")

---

Tags

yii2extensioncontextmenuyii2-contextmenu

### Embed Badge

![Health badge](/badges/liyunfang-yii2-contextmenu/health.svg)

```
[![Health](https://phpackages.com/badges/liyunfang-yii2-contextmenu/health.svg)](https://phpackages.com/packages/liyunfang-yii2-contextmenu)
```

###  Alternatives

[yiister/yii2-advanced-grid

Advanced GridView extension for Yii framework 2

4712.5k](/packages/yiister-yii2-advanced-grid)

PHPackages © 2026

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