PHPackages                             salahhusa9/laravel-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. salahhusa9/laravel-menu

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

salahhusa9/laravel-menu
=======================

Html menu generator for Laravel

v1.1.2(1y ago)164.8k—0%1[11 PRs](https://github.com/salahhusa9/laravel-menu/pulls)MITPHPPHP ^8.1CI passing

Since Mar 21Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/salahhusa9/laravel-menu)[ Packagist](https://packagist.org/packages/salahhusa9/laravel-menu)[ Docs](https://github.com/salahhusa9/laravel-menu)[ RSS](/packages/salahhusa9-laravel-menu/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (12)Versions (24)Used By (0)

Laravel Menu Generator
======================

[](#laravel-menu-generator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6838e3557282ba2970310cd78ccddb1a7ac10f37443f0189e4ae0ec0580cb33d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616c616868757361392f6c61726176656c2d6d656e752e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/salahhusa9/laravel-menu)[![GitHub Tests Action Status](https://camo.githubusercontent.com/7cb2cf14a744be0688e63e5786ba8252d447f6657658200ae0073cd4547af9cf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73616c616868757361392f6c61726176656c2d6d656e752f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/salahhusa9/laravel-menu/actions?query=workflow%3Arun-tests+branch%3Amain)[![PHPStan Status](https://camo.githubusercontent.com/584d6eb18117378855070fbf9005be0c7e8d4c18586eee972b0aae21b3e5bf5f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73616c616868757361392f6c61726176656c2d6d656e752f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d5048505374616e267374796c653d666c61742d737175617265)](https://github.com/salahhusa9/laravel-menu/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/310752926afd588c16970d15124a60e4156a5c68dbb2bfc8745e407fb59d0166/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73616c616868757361392f6c61726176656c2d6d656e752e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/salahhusa9/laravel-menu)

This is a useful package for building menus in your Laravel application, and it can help simplify the process of creating and managing menus in your application.

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

[](#installation)

You can install the package via composer:

```
composer require salahhusa9/laravel-menu
```

You can publish the config file with:

```
php artisan vendor:publish --tag="menu-config"
```

Optionally, you can publish the views using

```
php artisan vendor:publish --tag="menu-views"
```

Usage
-----

[](#usage)

### Basic

[](#basic)

You can create menu in your application in any place you want, but the best place is in the AppServiceProvider.php file in the boot() method.

```
use SalahHusa9\Menu\Facades\Menu;

public function boot()
{
    Menu::add('test', 'route.name', 'fa fa-home');
}
```

Add items to the menu using the add() method. You can chain multiple add() calls to add multiple items.

```
Menu::add('test')
    ->add('test2');
```

To create a submenu, call addSubmenu() on a menu item and add items to the submenu using the add() method.

```
Menu::add('test')
    ->add('test2')
    ->addSubmenu('test3', function ($submenu) {
        $submenu->add('test4');
    })
    ->add('test5');
```

### Blade

[](#blade)

To render the menu, use the `` blade component.

```

```

### Customization of the menu

[](#customization-of-the-menu)

Icons can be added to the menu items by passing the icon parameter to the add() method.

```
Menu::add('test', 'route.name', ['icon' => 'fa fa-home']);
```

You can also add a id and class to the menu item by passing the id and class parameters to the add() method.

```
Menu::add('test', 'route.name',['class' => 'customClass', 'id' => 'customId']);
```

You can also add a target to the menu item by passing the target parameter to the add() method.

```
Menu::add('test', 'route.name', ['target' => '_blank']);
```

You can also add a badge to the menu item by passing the badgeClass and badgeName parameters to the add() method.

```
Menu::add('test', 'route.name', ['badgeClass' => 'badge badge-success', 'badgeName' => 'New']);
```

You can also

```
// old:
if (auth()->user()->can('gateName')){
    Menu::add('test', 'route.name');
}
// new:
Menu::add('test', 'route.name', ['gateName' => 'gateName']);
```

### Customization of the menu view

[](#customization-of-the-menu-view)

You can customize the menu view by publishing the views using

```
php artisan vendor:publish --tag="menu-views"
```

### Multiple Menus

[](#multiple-menus)

You can create multiple menus in your application:

```
    Menu::make('sidebar', function ($menu) {
        $menu->add('test', 'route.name');
    });

    Menu::make('main', function ($menu) {
        $menu->add('test', 'route.name');
    });
```

For render the menu, use the `` blade component.

Configuration of the defult menu Classes of Ul and Li and the active class
--------------------------------------------------------------------------

[](#configuration-of-the-defult-menu-classes-of-ul-and-li-and-the-active-class)

You can publish the config file with:

```
php artisan vendor:publish --tag="menu-config"
```

and you can change the defult menu Classes of Ul and Li and the active class

```
return [
    "ul_class" => "menu-inner py-1", // default menu class
    "ul_sub_menu_class" => "menu-sub", // default submenu class

    "li_class" => "menu-item", // default menu item class
    "li_sub_menu_class" => "menu-item", // default submenu item class
    "li_sub_menu_open_class" => "menu-item active open", // default submenu item class when open

    "a_class" => "menu-link", // default menu link class
    "a_sub_menu_class" => "menu-link menu-toggle", // default submenu link class

    "icon_class" => "menu-icon", // default menu icon class

    "li_active_class" => "active", // default active class of li
    "a_active_class" => "active", // default active class of a

    "badge_class" => "badge rounded-pill ms-auto", // default badge class
];
```

Advanced
--------

[](#advanced)

Each Item accept this parames :

```
add(
    $name,
    $routeName = null,
    $options = [],
)

addSubmenu(
    $name,
    callback $callbackOfSubmenu,
    $options
)
```

There is other functions that you can used :

```
Menu::getMenuAsJson(); // return the menu as json
Menu::renderAsJson(); // return the menu as json
Menu::renderAsHtml(); // return the menu as html
```

Roadmap
-------

[](#roadmap)

See the [open issues](../../issues) for a list of proposed features (and known issues).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [salahhusa9](https://github.com/salahhusa9)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance64

Regular maintenance activity

Popularity30

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 85.2% 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 ~106 days

Total

5

Last Release

723d ago

Major Versions

v0.0.1 → v1.0.02023-07-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/4191314cbc45f7d51077e26cb1eac2a4d6e1df4de537d03778d2753391d6f03b?d=identicon)[salahhusa9](/maintainers/salahhusa9)

---

Top Contributors

[![salahhusa9](https://avatars.githubusercontent.com/u/64494826?v=4)](https://github.com/salahhusa9 "salahhusa9 (138 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

laravelmenumenu-generatorphplaravellaravel-menusalahhusa9

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/salahhusa9-laravel-menu/health.svg)

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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