2017 © Pedro Peláez
 

project laravel-nav-tools

NavTools package

image

syscover/laravel-nav-tools

NavTools package

  • Wednesday, March 29, 2017
  • by carlospalacin
  • Repository
  • 2 Watchers
  • 1 Stars
  • 61 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 17 Versions
  • 0 % Grown

The README.md

NavTools package to Laravel 5.4

Total Downloads Latest Stable Version License, (*1)

Installation

1 - From the command line run, (*2)

composer require syscover/laravel-nav-tools

2 - Register service provider, on file config/app.php add to providers array, (*3)

Syscover\NavTools\NavToolsServiceProvider::class,

3 - To publish package, you must type on console, (*4)

php artisan vendor:publish --provider="Syscover\NavTools\NavToolsServiceProvider"

4 - Register middlewares pulsar.navTools on file app/Http/Kernel.php add to routeMiddleware array, (*5)

'pulsar.navTools' => \Syscover\NavTools\Middleware\NavTools::class,

General configuration environment values

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:, (*6)

NAVTOOLS_URL_TYPE=lang

you can work with this urls, (*7)

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

for urls type country, (*8)

NAVTOOLS_URL_TYPE=country

you can work with this urls, (*9)

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

for urls type lang-country, (*10)

NAVTOOLS_URL_TYPE=lang-country

you can work with this urls, (*11)

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

Set NAVTOOLS_LANGS options on environment file .env

Set countries available in your web, (*12)

NAVTOOLS_LANGS=en|es

Set NAVTOOLS_COUNTRIES options on environment file .env

Set countries available in your web, (*13)

NAVTOOLS_COUNTRIES=us|gb|es

Set NAVTOOLS_DEFAULT_COUNTRY options on environment file .env

Set default country for your web, (*14)

NAVTOOLS_DEFAULT_COUNTRY=es

Routing with NavTools

On app\Http\routes.php file use this closure to implement routes with translation, (*15)

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

    // write here your routes

});

Route configuration

You have several url configuration options depends on the chosen NAVTOOLS_URL_TYPE parameter:, (*16)

Write your routes with lang variable, (*17)

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, (*18)

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, (*19)

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., (*20)

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']);
});

Get values in your application

You can get lang and country values with this helpers., (*21)

user_country(); // to get country user
user_lang(); // to get language user

To set routes you need to add lang or country parameters depending on NAVTOOLS_URL_TYPE., (*22)

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., (*23)

nt_route('routeName');

You can use redirect() helper without any trouble, we have extended Laravel core so that redirect()->route() does the same as nt_route()., (*24)

If you want to change the language or the country you must use this helpers, (*25)

change_language('en');
change_country('us');

License

The NavTools is open-sourced software licensed under the MIT license., (*26)

The Versions

29/03 2017

dev-master

9999999-dev

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

29/03 2017

v3.0.9

3.0.9.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

23/02 2017

v3.0.8

3.0.8.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

15/02 2017

v3.0.7

3.0.7.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

27/01 2017

v3.0.6

3.0.6.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

27/01 2017

v3.0.5

3.0.5.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

26/01 2017

v3.0.4

3.0.4.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

26/01 2017

v3.0.3

3.0.3.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

26/01 2017

v3.0.2

3.0.2.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

25/01 2017

v3.0.1

3.0.1.0

NavTools package

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel language locale set language set country

25/01 2017

v3.0.0

3.0.0.0

NavTools package

  Sources   Download

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel locale nav tools lang pulsar syscover

27/12 2016

v2.0.2

2.0.2.0

NavTools package

  Sources   Download

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel locale nav tools lang pulsar syscover

27/12 2016

v2.0.1

2.0.1.0

NavTools package

  Sources   Download

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel locale nav tools lang pulsar syscover

03/09 2016

v2.0.0

2.0.0.0

NavTools package

  Sources   Download

The Requires

  • php >=5.6.4

 

by SYSCOVER SL

laravel locale nav tools lang pulsar syscover

23/08 2016

v1.0.1

1.0.1.0

NavTools package

  Sources   Download

The Requires

  • php >=5.5.9

 

by SYSCOVER SL

laravel locale nav tools lang pulsar syscover

11/08 2016

v1.0.0

1.0.0.0

Nav Tools package

  Sources   Download

The Requires

  • php >=5.5.9

 

by SYSCOVER SL

laravel locale nav tools lang pulsar syscover

22/01 2016

5.1.x-dev

5.1.9999999.9999999-dev

Lang Locale package

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by SYSCOVER SL

laravel locale lang pulsar syscover