laminas-navigation manages trees of pointers to web pages. Simply put: It can be used for creating menus, breadcrumbs, links, and sitemaps, or serve as a model for other navigation related purposes.
Pages and Containers
There are two main concepts in laminas-navigation: pages and containers.
A page (
Laminas\Navigation\AbstractPage) in laminas-navigation, in its most basic
form, is an object that holds a pointer to a web page. In addition to the
pointer itself, the page object contains a number of other properties that are
typically relevant for navigation, such as
Read more about pages in the pages section.
A navigation container (
Laminas\Navigation\AbstractContainer) holds pages. It has
methods for adding, retrieving, deleting and iterating pages. It implements the
can thus be iterated with SPL iterators such as
Read more about containers in the containers section.
Pages are containers
Laminas\Navigation\AbstractContainer, which means that a page can have sub pages.
Separation of data (model) and rendering (view)
Classes in the laminas-navigation namespace do not deal with rendering of
navigational elements. Rendering is done with navigational view helpers.
However, pages contain information that is used by view helpers when rendering,
for sitemaps, etc.
Read more about rendering navigational elements in the view helpers section.