PHPackages                             skylineos/yii-menu - 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. skylineos/yii-menu

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

skylineos/yii-menu
==================

Yii2 extention for creating and managing menus

0.9.13(3y ago)091↓100%BSD-3-ClausePHPPHP ~8

Since Aug 17Pushed 3y ago4 watchersCompare

[ Source](https://github.com/skylineos/yii-menu)[ Packagist](https://packagist.org/packages/skylineos/yii-menu)[ RSS](/packages/skylineos-yii-menu/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (16)Used By (0)

Yii2 Menu
=========

[](#yii2-menu)

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

[](#installation)

*Composer:*

`"skylineos/yii-menu": "~1.0"`

*Run Migrations:*

`php yii migrate/up --migrationPath=vendor/skylineos/yii-menu/src/migrations`

> It is recommended though in no way required you create a migration in your own app to link the properties `createdBy` and `modifiedBy` as foreign keys to the primary keys of your User model (whatever that may be).

Once configured (below), you should be able to access the manager at /menu/menu/index

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

[](#configuration)

> config/web.php

```
'modules' => [
    'menu' => [
        'class' => 'skylineos\yii\menu\Module',
        'viewPath' => '@app/path/to/my/admin/views', // eg. @app/modules/cms/views. The system looks for [menu|menu-item] folders
        'roles' => ['@'], // optional yii authorization roles
        'dropdownClass' => 'app\path\to\dropDownClass', // @see https://www.yiiframework.com/extension/yiisoft/yii2-bootstrap4/doc/api/2.0/yii-bootstrap4-dropdown

        /**
         * Additional templates can be added as such: (namespace => display/friendly name)
         * @see [Building Templates]
         */
        'templates' => [
            'skylineos\yii\menu\widgets\SkyMenuWidget' => 'Useful for simple demo',
            'app\widgets\menus\OtherMenuWidget' => 'My Other Custom Widget',
        ],

        'targets' => [
            // See 'Defining Targets'
        ]
    ],
],
```

Defining Link Targets
---------------------

[](#defining-link-targets)

Targets (defining what the menu items can link to) can be handled three ways, all within the 'targets' property of the module:

```
'targets' => [
    // Here, slug will be mapped to title, both pulled directly from Content
    'app\models\Content' => [
        'slug' => 'slug',
        'display' => 'title',
        'where' => [], // optional
        'orderBy' => 'title ASC', // optional
        'dropdownGroup' => 'Pages',
    ],

    // This will interpret the model property of Router and map the 'slug' to the 'model.title' based on the fk
    // literal => false
    'app\models\Router' => [
        'slug' => 'slug',
        'display' => [
            'literal' => false,
            'className' => 'model',
            'pk' => 'id', // The primary key on the foreign model. If not provided, 'id' will be assumed
            'fk' => 'modelId',
            'property' => 'title',
            'where' => [], // optional
            'orderBy' => 'title ASC' // optional
        ],
        'where' => [],
        'orderBy' => 'title ASC',
        'dropdownGroup' => 'All Routes',
    ],

    // This will load the literal map of ProductCatalog.slug to Product.metaTitle.
    // literal => true
    'app\models\ProductCatalog' => [
        'slug' => 'slug',
        'display' => [
            'literal' => true,
            'className' => 'app\models\Product',
            'pk' => 'id', // The primary key on the foreign model. If not provided, 'id' will be assumed
            'fk' => 'modelId',
            'property' => 'metaTitle',
        ],
        'where' => [],
        'orderBy' => 'Product.sortOrder ASC',
        'dropdownGroup' => 'Products',
    ],
],

```

Usage
-----

[](#usage)

This package comes with a helper widget that will process your menu and render it using whatever templates you've configured on your menu items.

Make sure your templates (`menuTemplates` and `dropDownTemplates`) meet the requirements. See Building Templates

If these requirements do not suit your needs, you are, of course, more than welcome to develop your own widget that renders the items however you like.

``

Where `$menuId` is the `id` of the Menu you wish to render.

Building Templates
------------------

[](#building-templates)

Menu Templates:

See `examples/MenuTemplate.php` in this repository

DropDown Templates:

See `examples/DropDownTemplate.php` in this repository

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Recently: every ~110 days

Total

14

Last Release

1281d ago

PHP version history (2 changes)0.9.0PHP ~8.0.0

0.9.12PHP ~8

### Community

Maintainers

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

---

Tags

menuyii2bootstrap 4

###  Code Quality

TestsCodeception

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/skylineos-yii-menu/health.svg)

```
[![Health](https://phpackages.com/badges/skylineos-yii-menu/health.svg)](https://phpackages.com/packages/skylineos-yii-menu)
```

###  Alternatives

[extpoint/yii2-megamenu

Configurable site map with auto generate page title, breadcrumbs and navigation

3310.9k](/packages/extpoint-yii2-megamenu)[hail812/yii2-adminlte-widgets

yii2 adminlte widgets

10246.8k4](/packages/hail812-yii2-adminlte-widgets)[digitv/yii2bootstrap4

Yii2 Bootstrap 4 widgets

142.5k](/packages/digitv-yii2bootstrap4)[simialbi/yii2-kanban

Kanban board module for yii2

111.1k1](/packages/simialbi-yii2-kanban)

PHPackages © 2026

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