PHPackages                             movemoveapp/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. movemoveapp/laravel-localization

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

movemoveapp/laravel-localization
================================

Easy localization for Laravel with a support for localization switch by domain names.

v1.7.2(3y ago)5133MITPHPPHP &gt;=7.1.0

Since Jan 19Pushed 3y agoCompare

[ Source](https://github.com/movemoveapp/laravel-localization)[ Packagist](https://packagist.org/packages/movemoveapp/laravel-localization)[ Docs](https://github.com/movemoveapp/laravel-localization)[ GitHub Sponsors](https://github.com/iwasherefirst2)[ GitHub Sponsors](https://github.com/mcamara)[ RSS](/packages/movemoveapp-laravel-localization/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (3)Versions (97)Used By (0)

Laravel Localization
====================

[](#laravel-localization)

[![Build Status](https://camo.githubusercontent.com/7c84a40b6de534b7aa4b912e4aa32929ee66aed22639b5473e4cefd3639e339a/68747470733a2f2f6170702e7472617669732d63692e636f6d2f6d6f76656d6f76656170702f6c61726176656c2d6c6f63616c697a6174696f6e2e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/movemoveapp/laravel-localization)[![Latest Stable Version](https://camo.githubusercontent.com/2ddda8726a160d63385b98fdd211e232f520411df5438a589d06becd0b1b3e27/68747470733a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d6c6f63616c697a6174696f6e2f76)](//packagist.org/packages/movemoveapp/laravel-localization)[![Total Downloads](https://camo.githubusercontent.com/944412f0b7c402061d6319b05fb75f3c4dbe3593892bd88635f97d9d14347397/68747470733a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d6c6f63616c697a6174696f6e2f646f776e6c6f616473)](//packagist.org/packages/movemoveapp/laravel-localization)[![License](https://camo.githubusercontent.com/9b126df8ff39c19ba3892ac6f2f8eb4a56732d48b463c0c190bb7486aa62f844/68747470733a2f2f706f7365722e707567782e6f72672f6d6f76656d6f76656170702f6c61726176656c2d6c6f63616c697a6174696f6e2f6c6963656e7365)](//packagist.org/packages/movemoveapp/laravel-localization)

About Fork
----------

[](#about-fork)

This package is a fork of [mcamara/laravel-localization](https://github.com/mcamara/laravel-localization) with a support for localization switch by domain names like to

- exmaple.com - english version
- example.es - versión en español
- example.ru - русская версия

or

- en.exmaple.com - english version
- es.example.com - versión en español
- ru.example.com - русская версия

Read a more information about new feature [Localization Switch By Domain Names](#localization-switch-by-domain-names)

Introduction
------------

[](#introduction)

Easy i18n localization for Laravel, an useful tool to combine with Laravel localization classes.

The package offers the following:

- Detect language from browser
- Smart redirects (Save locale in session/cookie)
- Smart routing (Define your routes only once, no matter how many languages you use)
- Translatable Routes
- Supports caching &amp; testing
- Option to hide default locale in url
- Many snippets and helpers (like language selector)
- **Smart redirects between domain names**

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

[](#table-of-contents)

- [Installation](#installation)
- [One Domain Usage](#one-domain-usage)
- [Localization Switch By Domain Names](#localization-switch-by-domain-names)
    - [Domains .env properties](#domains-env-properties)
- [Redirect Middleware](#redirect-middleware)
- [Helpers](#helpers)
- [Translated Routes](#translated-routes)
- [Caching routes](#caching-routes)
- [Testing](#testing)
- [Common Issues](#common-issues)
    - [POST is not working](#post-is-not-working)
    - [MethodNotAllowedHttpException](#methodnotallowedhttpexception)
    - [Validation message is always in default locale](#validation-message-is-only-in-default-locale)
- [Collaborators](#collaborators)
- [Changelog](#changelog)
- [License](#license)

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

[](#laravel-compatibility)

Laravellaravel-localization4.0.x0.13.x4.1.x0.13.x4.2.x0.15.x5.0.x/5.1.x1.0.x5.2.x-5.4.x (PHP 7 not required)1.2.x5.2.x-5.8.x (PHP 7 required)1.3.x5.2.0-6.x (PHP 7 required)1.4.x5.2.0-8.x (PHP 7 required)1.6.xInstallation
------------

[](#installation)

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

For Laravel 5.4 and below it necessary to [register the service provider](/ADDITIONS.md#for-laravel-5.4-and-below).

### Config Files

[](#config-files)

In order to edit the default configuration you may execute:

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

```

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

The configuration options are:

- **supportedLocales** Languages of your app (Default: English &amp; Spanish) and localization domain name.
- **useAcceptLanguageHeader** If true, then automatically detect language from browser.
- **hideDefaultLocaleInURL** If true, then do not show default locale in url.
- **localesOrder** Sort languages in custom order.
- **localesMapping** Rename url locales.
- **utf8suffix** Allow changing utf8suffix for CentOS etc.
- **urlsIgnored** Ignore specific urls.

### Register Middleware

[](#register-middleware)

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

```
