Download the PHP package zentlix/knp-menu without Composer
On this page you can find all versions of the php package zentlix/knp-menu. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zentlix/knp-menu
More information about zentlix/knp-menu
Files in zentlix/knp-menu
Package knp-menu
Short Description The package provides object-oriented menus for projects based on the Spiral Framework
License MIT
Homepage https://github.com/zentlix/knp-menu
Informations about the package knp-menu
KnpMenu
The package provides object-oriented menus for projects based on the Spiral Framework.
Requirements
Make sure that your server is configured with following PHP version and extensions:
- PHP 8.1+
- Spiral framework 3.5+
Installation
You can install the package via composer:
To enable the package, you just need to add Spiral\KnpMenu\Bootloader\KnpMenuBootloader
to the bootloaders list, which is located in the class of your application.
Note If you are using
spiral-packages/discoverer
, you don't need to register bootloader by yourself.
Configuration
The configuration file for this package should be located at app/config/knp-menu.php
.
Within this file, you may configure default template
and template_options
for all menus.
Also, you can register menus
.
For example, the configuration file might look like this.
Creating a menu
To create a menu, create a class and implement interface Spiral\KnpMenu\MenuInterface
.
After that, you can register the menu in the config
file as shown above,
or register it using Spiral\KnpMenu\MenuRegistry
.
Using
If you are using Twig, you can use the knp_menu_render
extension to render the menu.
With custom template or other options.
Warning To use other templating engines, need to implement the menu display mechanism yourself.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.
All versions of knp-menu with dependencies
knplabs/knp-menu Version ^3.3
spiral/boot Version ^3.5
spiral/config Version ^3.5
spiral/core Version ^3.5
spiral/views Version ^3.5