honed/nav

Create backend driven navigation routes with server-side authorization in Laravel.

Fund package maintenance!
Honed

v0.3.0 2025-02-25 03:10 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

composer require honed/nav

Usage

Interact with the Nav facade to create navigation items.

Nav::items(NavItem::make('Home', '/'), NavItem::make('About', '/about'), NavItem::make('Contact', '/contact'));

You can create groups of navigation items, allowing you to select which ones to send to the page on render. By default, if you don't specify a group, the items will be added to the default group.

Nav::group('main', [
    NavItem::make('Home', '/'),
    NavItem::make('About', '/about'),
    NavItem::make('Contact', '/contact'),
]);
Nav::use('main');

You can use the SharesNavigation middleware to share the navigation items with the page automatically using merged props. This will append the navigation items to the page props using the nav key. If you want to simplify this, you can use the client-side composable useNavigation to handle this automatically and provide the necessary interfaces. See the documentation for the client package for more information.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.