- How do I install graham-campbell/navigation in Laravel?
- Install it with Composer using composer require graham-campbell/navigation. On Laravel 5.0 through 5.4, manually register the package service provider and facade in config/app.php, and verify auto-discovery on Laravel 5.5 and later. Publish any optional config or views if needed, then define menus in a view composer or dedicated provider before rendering them in Blade.
- Which Laravel and PHP versions does graham-campbell/navigation support?
- The package targets Laravel 5.x and the PHP versions permitted by its Composer constraints. It is not suitable for Laravel 6 and newer without fork-level work or a replacement. Run composer why-not against your target PHP and Laravel pair before committing, and pin the exact version in your lock file.
- How do I create nested navigation menus with this package?
- You define menus fluently by adding items and groups through the package chainable API, nesting child items under a parent. Rendering produces clean nested lists that you output through a Blade partial. Keep menu definitions in a view composer or config so the structure stays reusable across layouts.
- Does graham-campbell/navigation handle active menu states automatically?
- The package provides per-item active-state handling, generally based on route or URL matching. For parameterized and wildcard routes, explicitly test the detection behavior and add your own logic if exact matching is not enough. If active navigation is business-critical, wrap the rules behind an internal contract.
- How do I render a navigation menu in Blade with this package?
- Render the menu through the package facade or a menu object and output the generated nested list in a Blade template. The safest approach is to render through exactly one Blade partial so the implementation can be swapped later. You can customise rendering through the package views if you publish or override them.
- Can I customise HTML attributes and labels for navigation items?
- Yes, the fluent API supports labels, URLs, per-item attributes, and HTML attributes for menu items and groups. Use the chainable methods to keep menu definitions readable. When overriding views, escape labels and URLs to avoid XSS exposure from unescaped markup.
- Is graham-campbell/navigation safe for production use?
- Its runtime security surface is modest because it mainly generates markup and URLs, but the package appears abandoned for new work: Laravel 5 only, zero dependents, no stars reported, and a low score. The main risks are blocked framework upgrades, Composer conflicts, missing bug and security fixes, facade alias collisions, and published-view drift. Adopt it behind an application-owned abstraction or build a thin in-house menu builder for new projects.
- How should I test menus built with graham-campbell/navigation?
- Add contract tests for rendered markup, generated URLs, nested output, and active states. Test parameterized and wildcard routes explicitly, plus any custom view overrides, because exact-match active detection may not cover them. Rendering the single Blade partial in feature tests helps protect both behavior and the eventual exit path.
- What are alternatives to graham-campbell/navigation for Laravel menus?
- For new builds or Laravel 6 and newer, a thin in-house config-driven menu builder with a Blade component is often the better fit. You can also use maintained menu packages or Laravel route and URL helpers combined with Blade components. If you must stay on Laravel 5.x, keep the package behind an internal MenuBuilder or MenuRenderer contract.
- How do I avoid lock-in and migrate away from this package later?
- Adopt it behind an application-owned abstraction from day one: keep menu definitions in config or a dedicated provider/view composer, render through exactly one Blade partial, and forbid direct facade calls in controllers and scattered views. That makes the package swappable for an in-house builder or another package. During framework upgrades, migrate menus incrementally rather than rewriting all navigation at once.