PHPackages                             dluwang/navigator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dluwang/navigator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dluwang/navigator
=================

Navigator manager service

v1.3.1(7y ago)04MITPHP

Since Jan 7Pushed 7y agoCompare

[ Source](https://github.com/dluwang/navigator)[ Packagist](https://packagist.org/packages/dluwang/navigator)[ RSS](/packages/dluwang-navigator/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (5)Versions (14)Used By (0)

**Navigation Service**
======================

[](#navigation-service)

[![Build Status](https://camo.githubusercontent.com/d372290aa59665ce52945e1648048b4452295c054262c0102b663bca5a543aa6/68747470733a2f2f7472617669732d63692e6f72672f646c7577616e672f6e6176696761746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dluwang/navigator)[![Latest Stable Version](https://camo.githubusercontent.com/32577a1054ee7aa01a03e3983f0c9fc607072052f68a8735d7e465300e07fd31/68747470733a2f2f706f7365722e707567782e6f72672f646c7577616e672f6e6176696761746f722f762f737461626c65)](https://packagist.org/packages/dluwang/navigator)[![License](https://camo.githubusercontent.com/e65e734f1cbbb741b077b3e87415f4e07b674c9b9cb2e0d9f9328341436ae879/68747470733a2f2f706f7365722e707567782e6f72672f646c7577616e672f6e6176696761746f722f6c6963656e7365)](https://packagist.org/packages/dluwang/navigator)

This is a package that provide service to manage navigations

**Note**
--------

[](#note)

Laravel VersionPackage Version5.51.0.\*5.61.1.\*5.71.2.\*5.81.3.\***Installation**
----------------

[](#installation)

```
composer require dluwang/navigation

```

**Usage**
---------

[](#usage)

**Define Navigation**

`Dluwang/Navigator/Navigation` is a class to define your navigation. The `__construct` method has two mandatory arguments and four optional arguments

```
public function __construct($id, $url, $order = 1, $parent = null, array $attributes = [], array $childs = [])
```

1. `$id` is the id of the navigation
2. `$url` is the url of the navigation
3. `$order` is number for sorting the navigation
4. `$parent` is the parent of the navigation
5. `$attributes` is the additional attributes of navigation
6. `$childs` is the childs of navigation

All of the properties above can be accessed via the object instance.

**Registering child**

There are two ways to register navigation's child.

- **Eager child registration**

```
$navigation->registerChild($childNavigation) // single child registration`

$navigation->registerChild([$childNavigation2, $childNavigation2]) // multiple childs registration
```

- **Deferred child registration**

Sometimes you want to hook navigation and register the child somewhere in your app. You just need to specify the parent argument with the `navigation-id` you want to hook.

```
$navigation = new Navigation('navigation-id', 'the-url', 'the-order', 'the-parent-navigation-id');
```

**Retrieveing all childs**

```
$navigation->childs()
```

**Retrievent child by id**

```
$navigation->child('navigation-id-wanted')
```

**Define Navigator**

`Dluwang/Navigator/BaseNavigator` is a class that act as the repository of Navigations. All Navigator implementation should implements `Dluwang/Navigator/Navigator` interface.

```
$navigator = new BaseNavigator()
```

Constructor has one optional argument which is the navigations you want to register.

**Registering navigations**

```
$navigator->register($navigation) // single navigation registration
```

```
$navigator->register([$navigation1, $navigation2]) // mutiple navigations
```

As mentioned above, the deferred child can be registered casually to navigator.

**Retrieve raw registered navigations**

This package under the hood do some data preparation such as sorting and collect deferred childs. To get raw data you can use.

```
$navigator->raw();
```

To specify parent, use:

```
$navigator->raw('parent-id');
```

To get prepared data you can use the methods below.

**Retrieve all navigations**

```
$navigator->navigations()
```

You can specify the navigations loaded by their parent.

```
$navigator->navigations('parent-id');
```

**Retrieve navigation by id**

```
$navigator->navigation('navigation-id')
```

**Integration**
---------------

[](#integration)

Currently, this package only integrated with **laravel framework**. You can register your defined navigation in you app service provider at the boot method. This integration add a caching mechanism when building navigation

```
public function boot() {

	// define navigation
	$navigation = ...

	$this->app->navigator->register($navigation);

}
```

**Tests**
---------

[](#tests)

To run test, run this following command

```
vendor/bin/phpunit

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Recently: every ~22 days

Total

12

Last Release

2590d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/86155a9709a56bf2ff58e7424d9ac9a1787aa8ae3612744771a393fa2bfb5668?d=identicon)[inologi](/maintainers/inologi)

---

Top Contributors

[![inologi](https://avatars.githubusercontent.com/u/46432122?v=4)](https://github.com/inologi "inologi (19 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dluwang-navigator/health.svg)

```
[![Health](https://phpackages.com/badges/dluwang-navigator/health.svg)](https://phpackages.com/packages/dluwang-navigator)
```

###  Alternatives

[jofrysutanto/windsor

YAML-ised Configuration for ACF

549.2k](/packages/jofrysutanto-windsor)[jshannon63/jsoncollect

Supercharge your JSON using collections

154.9k1](/packages/jshannon63-jsoncollect)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
