Weave Code
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

Zend Navigation Laravel Package

zendframework/zend-navigation

Abandoned Zend Framework navigation component for building and managing navigation trees (menus, breadcrumbs, links, sitemaps). Repository moved to laminas/laminas-navigation; see Laminas docs for current usage.

View on GitHub
Deep Wiki
Context7

Getting Started

This is the legacy Zend Framework zend-navigation component—now archived and unmaintained since 2019. It provides simple, configurational navigation (e.g., menus, breadcrumbs) driven by Zend\Navigation\Page objects. If you're starting a new Laravel project, do not use this—use Laravel’s built-in pagination, or modern packages like spatie/laravel-menu. However, if you’re maintaining a legacy ZF2/Laminas port or PHP 5.x/7.0–7.3 app, here’s how to get going:

  1. Install via Composer (PHP 7.3 support added in 2.9.1):
    composer require zendframework/zend-navigation:^2.9
    
  2. Bootstrap pages using Zend\Navigation\Page\Mvc or Zend\Navigation\Page\Uri:
    use Zend\Navigation\Page\Mvc;
    
    $pages = [
        Mvc::factory([
            'label' => 'Home',
            'route' => 'home',
            'active' => true,
        ]),
        // more pages...
    ];
    
  3. Render in Blade (with a view helper wrapper or via direct PHP):
    // In a service or controller
    $container = new Zend\Navigation\Navigation($pages);
    echo $view->navigation($container)->menu();
    

Check data/README.md or Laminas’ archived docs—the component was migrated to laminas/laminas-navigation, but Laravel doesn’t integrate it natively.


Implementation Patterns

  • Config-driven navigation: Store navigation structure in config (config/navigation.php) as an array of pages—then build the container from config:

    $pages = Zend\Navigation\Page\Page::factory(config('navigation.main'));
    $navigation = new Zend\Navigation\Navigation($pages);
    
  • Dynamic page generation: Build pages conditionally based on user permissions, e.g., in a middleware or view composer:

    if ($user->isAdmin()) {
        $pages[] = Zend\Navigation\Page\Uri::factory(['label' => 'Admin', 'uri' => '/admin']);
    }
    
  • Blade integration workaround: Since Laravel lacks view helpers, create a service class to expose Zend\Navigation methods:

    // App\Services\NavigationRenderer
    public function renderMenu(Zend\Navigation\Navigation $nav, $ulClass = 'nav'): string
    {
        $menu = new \Zend\View\Helper\Navigation\Menu;
        $menu->setUlClass($ulClass);
        return $menu->render($nav);
    }
    

    Then inject into Blade views: @inject('navRenderer', 'App\Services\NavigationRenderer').

  • Breadcrumb integration: Use Zend\View\Helper\Navigation\Breadcrumbs similarly.


Gotchas and Tips

  • PHP version support: Now supports PHP 7.3 (release 2.9.1), but still incompatible with PHP ≥7.4. If upgrading PHP, you must migrate away or backport patches—Laminas' fork may be a better short-term migration target.

  • No Laravel container resolution: Navigation relies on manual setup. Avoid relying on service location patterns it uses internally—inject dependencies explicitly.

  • Missing route resolution: Mvc pages need Zend\Mvc\Router (not available in Laravel). To bridge this:

    • Use Uri pages with url() helper via config('app.url') . '/path'
    • Or patch Mvc::factory() to resolve route via Laravel’s Route::url()—but this risks desync.
  • No Laravel events: Navigation doesn’t integrate with Laravel’s event/model bindings. You’ll need custom logic to update pages when models change.

  • Deprecated but still used: Some older Laminas-based apps still depend on it. If migrating to Laravel, consider:

    • Rewriting navigation config into Laravel’s config/breadcrumbs.php
    • Using spatie/laravel-breadcrumbs or custom Blade components instead.
  • Autoloading quirk: Since it’s Zend\* (not PSR-4), ensure vendor/composer/autoload_classmap.php includes it—or use zendframework/zend-servicemanager to bootstrap helper classes correctly.

  • Last stable version: 2.9.1 (2023-XX-XX) is the final—no CVEs reported, but security patches won’t be issued. Audit carefully for legacy usage.

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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport