rybakit/navigation-bundle
A Symfony bundle for building and rendering hierarchical navigation menus. Define menu trees, track the active item based on the current route, and output them in your templates with minimal setup. A lightweight way to keep site navigation organized and consistent across your application.
Before anything else: this is a Symfony bundle, not a Laravel package. There is no service provider, no facade, no config publishing. If you're evaluating it from a Laravel codebase, treat it as a reference implementation of the companion library rybakit/navigation, not something you composer require into a Laravel app.
First steps (if you're in a Symfony context):
composer require rybakit/navigation-bundle
Register the bundle in app/AppKernel.php (Symfony 2/3/4 era):
$bundles = [
new Rybakit\Bundle\NavigationBundle\RybakitNavigationBundle(),
];
Then define your first navigation container in config.yml — the bundle is configuration-driven, so nothing renders until you declare at least one container. A minimal "main menu" container with a couple of items is the fastest way to see output.
Where to look first:
DependencyInjection/Configuration.php for the exact config schema (this is the source of truth — docs are thin).rybakit/navigation README for item/container/matcher semantics, since the bundle just wires those into the container.First use case: a top-nav or sidebar menu where one item is "active" depending on the current request. That's what the matcher system is for.
Config-defined containers. The typical workflow is declaring navigation trees in YAML/PHP config rather than building them in controllers. Items get a label, URI, optional attributes, and optional children. This keeps menus out of PHP and lets non-devs edit them.
Rendering via Twig. The bundle exposes a Twig function (roughly {{ navigation('main') }}) that resolves the configured container service and hands it to a renderer. The renderer walks the tree and outputs markup — in practice you'll often override the template to match your CSS framework.
Active-state matching. Each container can be paired with a matcher (URI, regex, or callback). The matcher is evaluated against the current request, and matching items get an "active" attribute/class at render time. This is the main reason to use the package over hand-rolled arrays: you get a clean separation between what the menu is and whether an item is current.
Integration pattern — porting to Laravel. If you like the model, the realistic path is to use the standalone rybakit/navigation library and write a small NavigationServiceProvider that:
Container instances as singletons bound by name.@navigation('main') helper backed by a view composer.Request ($request->is(...), route()->getName()).That gives you ~90% of the bundle's value without the Symfony coupling.
Alternative in Laravel. For most apps spatie/laravel-menu or lavary/laravel-menu already cover this ground with better support and a current codebase. Benchmark against those before porting.
composer why-not before committing.Configuration.php node definitions are authoritative. If a key is silently ignored, it's almost always a typo’d node name being pruned by the config tree.MatcherInterface for custom "current page" logic (e.g., matching by route object instead of URI) and a custom renderer if you need JSON/API menu output.Resources/config layout are all Symfony-specific — don't expect Laravel-friendly abstractions, and don't try to shoehorn the bundle into a Laravel app. Pull in the underlying library instead.Bottom line for a Laravel developer: don't install this. Read it for the container + matcher design, then either use rybakit/navigation directly with a thin Laravel adapter, or reach for a maintained Laravel menu package. The conceptual model is worth borrowing; the delivery mechanism is not.
How can I help you explore Laravel packages today?