lm-commons / lmc-bootstrap-menu
This repository can generate nested bootstrap menu based on ul li tag. More may come later. Thanks!
Requires
- php: ^7.3 || ^8.0
- laminas/laminas-eventmanager: ^3.0
- laminas/laminas-loader: ^2.6
- laminas/laminas-modulemanager: ^2.5
- laminas/laminas-mvc: ^3.0
- laminas/laminas-navigation: ^2.10
This package is auto-updated.
Last update: 2024-10-24 14:21:03 UTC
README
This repository will contain bootstrap menu integration with laminas-mvc.
Pre-Requisites
You need to have bootstrap css and js file included in your layout.phtml. If not, you can still be able to see the generated html.
Introduction
This package generates a bootstrap menu based on the configuration given in your application. Which should be compatible with Laminas-Navigation. Because this package extends Laminas-Navigation therefore the configuration should match with Laminas-Navigation. This package came into existence with the help of Frank Brückner. Thanks for the help Frank Brückner. My first contribution to Laminas MVC.
Installation using Composer
composer require lm-commons/lmc-bootstrap-menu
Registering the modules in your application
<?php return [ 'modules' => [ // ... 'Laminas\Navigation', // <-- Add this line if not present 'LmcBootstrapMenu', // <-- Add this line in your root_path/config/modules.config.php file 'Application', ], ];
Menu Container Array
<?php // Application/config/module.config.php return [ // ... 'navigation' => [ 'default' => [ 'home' => [ 'label' => 'Home', 'route' => 'home', ], 'category' => [ 'label' => 'Category', 'uri' => '#', 'pages' => [ 'php' => [ 'label' => 'PHP', 'uri' => 'https://www.php.net', ], 'laminas' => [ 'label' => 'Laminas', 'uri' => 'https://getlaminas.org/', ], 'devider' => [ 'label' => '--devider', // most important 'route' => '#', ], 'magento' => [ 'label' => 'Magento', 'uri' => 'https://business.adobe.com/products/magento/magento-commerce.html', ], ], ] ] ], ];
Usage in MVC View
<?=$this->navigation('default') ->bootstrapMenu() ->setUlClass('navbar-nav'); ?>