Download the PHP package saeedhosan/laravel-menus without Composer
On this page you can find all versions of the php package saeedhosan/laravel-menus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download saeedhosan/laravel-menus
More information about saeedhosan/laravel-menus
Files in saeedhosan/laravel-menus
Package laravel-menus
Short Description The package is for laravel menu builder
License MIT
Informations about the package laravel-menus
Laravel Menus
Simple, flexible menu builder for Laravel.
Requirements
- PHP 8.2+
- Laravel 11, 12, or 13
Installation
The service provider is auto-discovered. To publish the config and views:
Creating a Menu
Create a class that extends MenuBuilder and define your items:
Item Properties
| Key | Type | Description |
|---|---|---|
name |
string |
Display label |
slug |
string |
Unique identifier used for positioning |
link |
string |
URL (optional) |
icon |
string |
Icon HTML (defaults to a bullet dot) |
active |
bool |
Marks item as active |
access |
string\|array |
Permission(s) checked via access callback |
badge |
string\|array |
Badge text, or ['text', 'css-class'] |
separator |
bool |
Renders as a section heading |
submenu |
array |
Nested menu items |
Registering Menus
Register your menus in a service provider:
Positioning Child Items
Control where child items are placed using the fluent filter API:
Updating a Menu's Parent
Move an existing menu registration to a different parent:
Rendering
As Array
As HTML
The package ships with Blade views compatible with Metronic/Bootstrap sidebar menus:
You can customize the views after publishing them:
Views are published to resources/views/vendor/laravel-menus.
Access Control
Items with an access key are filtered through a configurable callback. The default uses Laravel's Gate:
Define permissions on your items:
To use a custom callback, create an invokable class:
Renderable Condition
Control whether a menu renders at all by overriding renderable():
Badges
MenuBuilder provides badge helpers you can use in your items:
Testing
License
MIT