Download the PHP package syscover/langlocale without Composer
On this page you can find all versions of the php package syscover/langlocale. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download syscover/langlocale
More information about syscover/langlocale
Files in syscover/langlocale
Informations about the package langlocale
NavTools package to Laravel 5.4
Installation
1 - From the command line run
2 - Register service provider, on file config/app.php add to providers array
3 - To publish package, you must type on console
4 - Register middlewares pulsar.navTools on file app/Http/Kernel.php add to routeMiddleware array
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:
you can work with this urls
for urls type country
you can work with this urls
for urls type lang-country
you can work with this urls
Set NAVTOOLS_LANGS options on environment file .env
Set countries available in your web
Set NAVTOOLS_COUNTRIES options on environment file .env
Set countries available in your web
Set NAVTOOLS_DEFAULT_COUNTRY options on environment file .env
Set default country for your web
Routing with NavTools
On app\Http\routes.php file use this closure to implement routes with translation
Route configuration
You have several url configuration options depends on the chosen NAVTOOLS_URL_TYPE parameter:
Write your routes with lang variable
Or set lang variable on your routes
Or set constant lang but country variable
Or use lang and country variables to get language value.
Get values in your application
You can get lang and country values with this helpers.
To set routes you need to add lang or country parameters depending on NAVTOOLS_URL_TYPE.
You can use a custom helper nt_route(), this helper inserts automatically variables lang and country, unless you specify these variables.
You can use redirect() helper without any trouble, we have extended Laravel core so that redirect()->route() does the same as nt_route().
If you want to change the language or the country you must use this helpers
License
The NavTools is open-sourced software licensed under the MIT license.