Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Twig Navigation Extension

Twig Navigation Extension Laravel Package

m2mtech/twig-navigation-extension

A Twig extension for Laravel that builds and renders navigational menus from configuration, with support for active states, nested items, and easy customization in templates.

View on GitHub
Deep Wiki
Context7

Twig extensions for common navigation widgets for symfony.

Frequently asked questions about Twig Navigation Extension
How do I install m2mtech/twig-navigation-extension in a Laravel project?
Install it with Composer using composer require m2mtech/twig-navigation-extension. Because the package provides Twig extensions, make sure your Laravel app already has a working Twig integration if you plan to render menus in Twig templates. After installation, follow the package configuration instructions to register the extension and define your navigation menus.
Does this package work with Blade or only Twig?
The package is built around Twig extensions, so its native template helpers are intended for Twig rather than Blade. In a Laravel application you would typically need a Twig bridge or similar integration to use it. If your project uses Blade exclusively, this package is not a drop-in solution and you should consider Blade-oriented menu alternatives.
How do I define navigation menus in the configuration?
Menus are built from configuration, so you define your navigation items as structured data and let the extension render them. This keeps menu definitions out of templates and makes it easier to reuse the same navigation across pages. The exact configuration keys and nesting format should be confirmed against the package README for your version.
How do I render a navigation menu in a Twig template?
After registering the Twig extension, you call its navigation functions or filters from your Twig template to render the configured menu. The rendered output can include nested items and active-state classes based on the current route or URL. Check the package documentation for the exact function names and supported options.
How are active menu states determined?
The extension supports active states for navigation items, which lets you highlight the current section in your menu. Active state logic is typically driven by the current request or route information passed into the renderer. You can usually customize the active class or markup in your template.
Can I build nested or multi-level navigation menus?
Yes, the package is designed for navigation widgets with support for nested items. You can define parent and child items in configuration and render them as multi-level menus in Twig. Styling and depth behavior are handled in your templates and CSS.
How do I customize the HTML and CSS classes for the menu?
Customization happens in your Twig templates, where you control the markup around the rendered navigation items. You can add your own CSS classes, data attributes, and wrappers while still using the extension for menu structure and active states. Keep customizations in templates so configuration remains reusable.
Which Laravel and PHP versions are supported?
The package metadata and README are the authoritative source for supported Laravel, PHP, and Twig versions. The overview references Symfony-style Twig extensions, so verify compatibility with your Laravel Twig integration before installing. Composer will also enforce platform requirements during installation.
How should I test navigation rendering in a Laravel app?
Write feature or integration tests that request pages with known routes and assert the expected active classes and nested menu markup. If you use TwigBridge or another Twig integration, render the template in a test context and compare key navigation output. Keep menu configuration fixtures small so failures are easy to diagnose.
Is this package maintained for production use, and what alternatives should I check?
Review the repository's release history, open issues, and recent commit activity before using it in production. The package is a focused Twig extension for navigation widgets, so maintenance risk is best assessed against your Laravel and Twig versions. If your app is Blade-only, compare it with Blade-native menu packages, pin a known version in Composer, and include navigation rendering in your test suite.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings