PHP code example of honda / navigation

1. Go to this page and download the library: Download honda/navigation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

honda / navigation example snippets


use Felix\Navigation\Navigation;

Navigation::macro('theName', function (Navigation $navigation) {
    // ...
});

use Felix\Navigation\Navigation;

Navigation::theName();

$item->href('articles.index');

$item->href('articles.edit', ['article' => 1]);

$item->href('https://repo.new');

$item->icon('heroicon-eye');

$item->alwaysActive();

$item->activePattern('/articles/*');

use Felix\Navigation\Item;

$navigation->addIf($isAdmin, 'Settings', function (Item $item) {
    // ...
});
$navigation->addUnless($isReader, 'Articles', function (Item $item) {
    // ...
});

use Felix\Navigation\Item;
use Felix\Navigation\Section;

$navigation->addSection('Name', function (Section $section) {
    $section->add('Child', function (Item $item) {
        // ...
    });
});

use Felix\Navigation\Section;

$navigation->addSectionIf($isAdmin, 'Admin', function (Section $section) {
    // ...
});
$navigation->addSectionUnless($isReader, 'Bookmarks', function (Section $section) {
    // ...
});

// app/View/Components/Topbar.php
use Felix\Navigation\Components\Component;
class Topbar extends Component {
    public function viewName() : string{
         return 'components.topbar';
    }
}