PHPackages                             syscover/pulsar-navtools - 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. syscover/pulsar-navtools

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

syscover/pulsar-navtools
========================

Navtools package

0246PHP

Since Sep 13Pushed 7y ago2 watchersCompare

[ Source](https://github.com/syscover/pulsar-navtools)[ Packagist](https://packagist.org/packages/syscover/pulsar-navtools)[ RSS](/packages/syscover-pulsar-navtools/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Navtools package to Laravel
===========================

[](#navtools-package-to-laravel)

[![Total Downloads](https://camo.githubusercontent.com/7da24f91ecc31e9e5cd3e4682eb4054ba2aecde3192f5c80255597f6ef19eaa7/68747470733a2f2f706f7365722e707567782e6f72672f737973636f7665722f70756c7361722d6e6176746f6f6c732f646f776e6c6f616473)](https://packagist.org/packages/syscover/pulsar-navtools)[![Latest Stable Version](https://camo.githubusercontent.com/77853f71f042b39bc8aeb096d8de5e4c4ce3f47f262a9481e3aeb57d5efec944/68747470733a2f2f706f7365722e707567782e6f72672f737973636f7665722f70756c7361722d6e6176746f6f6c732f762f737461626c652e737667)](https://packagist.org/packages/syscover/pulsar-navtools)[![License](https://camo.githubusercontent.com/c7d0eab8ddfed1adae8bf15d9ea64c0572357122842ea8c3e99dea3f70a8c21b/68747470733a2f2f706f7365722e707567782e6f72672f737973636f7665722f70756c7361722d6e6176746f6f6c732f6c6963656e73652e737667)](https://packagist.org/packages/syscover/pulsar-navtools)

Installation
------------

[](#installation)

**1 - From the command line run**

```
composer require syscover/pulsar-navtools

```

**2 - To publish package, you must type on console**

```
php artisan vendor:publish --provider="Syscover\Navtools\NavtoolsServiceProvider"

```

**3 - Register middlewares pulsar.navtools on file app/Http/Kernel.php add to routeMiddleware array**

```
'pulsar.navtools' => \Syscover\Navtools\Middleware\Navtools::class,

```

General configuration environment values
----------------------------------------

[](#general-configuration-environment-values)

### Set NAVTOOLS\_URL\_TYPE options on environment file .env

[](#set-navtools_url_type-options-on-environment-file-env)

Set url type for you web, you have three types, lang, country or lang-country, for urls type lang:

```
NAVTOOLS_URL_TYPE=lang

```

you can work with this urls

```
hrrp://mydomain.com/en/any-page

```

for urls type country

```
NAVTOOLS_URL_TYPE=country

```

you can work with this urls

```
hrrp://mydomain.com/us/any-page

```

for urls type lang-country

```
NAVTOOLS_URL_TYPE=lang-country

```

you can work with this urls

```
hrrp://mydomain.com/en-us/any-page

```

### Set NAVTOOLS\_LANGS options on environment file .env

[](#set-navtools_langs-options-on-environment-file-env)

Set available languages in your web

```
NAVTOOLS_LANGS=en|es

```

### Set NAVTOOLS\_COUNTRIES options on environment file .env

[](#set-navtools_countries-options-on-environment-file-env)

Set available countries in your web

```
NAVTOOLS_COUNTRIES=us|gb|es

```

### Set NAVTOOLS\_DEFAULT\_COUNTRY options on environment file .env

[](#set-navtools_default_country-options-on-environment-file-env)

Set default country for your web

```
NAVTOOLS_DEFAULT_COUNTRY=es

```

### Routing with Navtools

[](#routing-with-navtools)

On app\\Http\\routes.php file use this closure to implement routes with translation

```
Route::group(['middleware' => ['pulsar.navtools']], function() {

    // write here your routes

});

```

#### Route configuration

[](#route-configuration)

You have several url configuration options depends on the chosen NAVTOOLS\_URL\_TYPE parameter:

Write your routes with lang variable

```
Route::group(['middleware' => ['pulsar.navtools']], function() {
    Route::get('/',                         function(){ return view('www.index'); });
    Route::get('{lang}',                  function(){ return view('www.index'); });
    Route::post('{lang}/contact',         ['as'=>'contact',  'uses'=>'FrontEndController@contact']);
});

```

Or set lang variable on your routes

```
Route::group(['middleware' => ['pulsar.navtools']], function() {
    Route::get('/',                   function(){ return view('www.index'); });

    Route::get('en',                  function(){ return view('www.index'); });
    Route::get('es',                  function(){ return view('www.index'); });

    Route::post('en/contact',         ['as' => 'contact-en',          'uses'=>'FrontEndController@contact']);
    Route::post('es/contacto',        ['as' => 'contact-es',          'uses'=>'FrontEndController@contact']);
});

```

Or set constant lang but country variable

```
Route::group(['middleware' => ['pulsar.navtools']], function() {
    Route::get('/',                   function(){ return view('www.index'); });

    Route::get('/en-{country}',                  function(){ return view('www.index'); });
    Route::get('/es-{country}',                  function(){ return view('www.index'); });

    Route::post('en-{country}'/contact',         ['as' => 'contact-en',          'uses'=>'FrontEndController@contact']);
    Route::post('es-{country}'/contacto',        ['as' => 'contact-es',          'uses'=>'FrontEndController@contact']);
});

```

Or use lang and country variables to get language value.

```
Route::group(['middleware' => ['pulsar.navtools']], function() {
    Route::get('/',                   function(){ return view('www.index'); });

    Route::get('/{lang}-{country}',                  function(){ return view('www.index'); });

    Route::post('/{lang}-{country}/contact',         ['as' => 'contact-en',          'uses'=>'FrontEndController@contact']);
});

```

Helper \[user\_country()\]
--------------------------

[](#helper-user_country)

Get country from user, a simple case

```
user_country(); // get country user

```

Helper \[user\_lang()\]
-----------------------

[](#helper-user_lang)

Get lang from user, a simple case

```
user_lang(); // get language user

```

Helper \[nt\_route()\]
----------------------

[](#helper-nt_route)

To set routes you need to add lang or country parameters depending on NAVTOOLS\_URL\_TYPE.

```
route('routeName', ['lang' => 'en', 'country' => 'us']);

```

You can use a custom helper **nt\_route()**, this helper inserts automatically variables lang and country, unless you specify these variables.

```
nt_route('routeName');

```

You can use **redirect()** helper without any trouble, we have extended Laravel core so that **redirect()-&gt;route()** does the same as **nt\_route()**.

Helper \[change\_lang()\]
-------------------------

[](#helper-change_lang)

You can change the language with change\_lang helper

```
change_lang('en');

```

Helper \[change\_country()\]
----------------------------

[](#helper-change_country)

You can change the country with change\_country helper

```
change_country('us');

```

Helper \[active\_route()\]
--------------------------

[](#helper-active_route)

Active route is a helper for to know when any route is active, has this properties:

- route:string|array = Route name or array of route names to target
- calls:string default:null = If isset this variable, helper will return the indicated string or a boolean
- firstOccurrence:float = Check that the first section of the url matches the route

A simple case

```
HOME

```

case with multiples routes

```
HOME

```

case with nested route

```
PRODUCT

```

Helper \[get\_lang\_route\_name()\]
-----------------------------------

[](#helper-get_lang_route_name)

Get the route name of current route in other language

```
Change Lang

```

Helper \[get\_lang\_route()\]
-----------------------------

[](#helper-get_lang_route)

Get the url of current route in other language

```
Change Lang

```

License
-------

[](#license)

The Navtools is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/70d93b133cd1355362a7c2b51a70734409a16402e670ba5c9912d0bb05c6df3f?d=identicon)[carlospalacin](/maintainers/carlospalacin)

---

Top Contributors

[![carlospalacin](https://avatars.githubusercontent.com/u/7494076?v=4)](https://github.com/carlospalacin "carlospalacin (27 commits)")

### Embed Badge

![Health badge](/badges/syscover-pulsar-navtools/health.svg)

```
[![Health](https://phpackages.com/badges/syscover-pulsar-navtools/health.svg)](https://phpackages.com/packages/syscover-pulsar-navtools)
```

PHPackages © 2026

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