PHPackages                             dongrim/laravel-localization - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. dongrim/laravel-localization

ActiveLibrary[Localization &amp; i18n](/categories/localization)

dongrim/laravel-localization
============================

Easy localization for Laravel

v1.0.1(3y ago)05MITPHPPHP &gt;=7.4.0

Since Jul 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/YaroslavFedan/laravel-localization)[ Packagist](https://packagist.org/packages/dongrim/laravel-localization)[ RSS](/packages/dongrim-laravel-localization/feed)WikiDiscussions master Synced 1mo ago

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

Easy i18n localization for Laravel.

The package offers the following:

- Detect language from browser
- Smart redirects (Save locale in session)
- Smart routing (Define your routes only once, no matter how many languages you use)
- Option to hide default locale in url

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Register Middleware](#register-middleware)
- [Usage](#usage)
- [Localization from database](#localization-database)
- [Recommended](#recommended)
- [Helpers](#helpers)
- [Caching routes](#caching-routes)

Laravel compatibility
---------------------

[](#laravel-compatibility)

Laravellaravel-localization6.0-9.x (PHP 7 required)1.0.xInstallation
------------

[](#installation)

Install the package via composer: `composer require dongrim/laravel-localization`

### Config Files

[](#config-files)

In order to edit the default configuration you may execute:

```
php artisan vendor:publish --provider="Dongrim\LaravelLocalization\LaravelLocalizationServiceProvider"

```

After that, `config/localization.php` will be created.

The configuration options are:

- **useAcceptLanguageHeader** If true, then automatically detect language from browser.
- **hideDefaultLocaleInURL** If true, then do not show default locale in url.
- **driver** two drivers are supported to access (Default: config file) the list of locales:
    - The configuration file config/localization.php
    - database
- **supportedLocales** Languages of your app (Default: English &amp; Spanish).
- **localesMapping** Rename url locales.

### Register Middleware

[](#register-middleware)

You may register the package middleware in the `app/Http/Kernel.php` file:

```
