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

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

fowitech/laravel-localization
=============================

Easy localization for Laravel

0245PHP

Since Jun 4Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/fowitech/laravel-localization)[ Packagist](https://packagist.org/packages/fowitech/laravel-localization)[ RSS](/packages/fowitech-laravel-localization/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-localization)

[![Latest Stable Version](https://camo.githubusercontent.com/4a0b8f770ee9bea661c9778d3b86359b35b84d8ebb3d1d8565ed3c046b0980f0/68747470733a2f2f706f7365722e707567782e6f72672f666f7769746563682f6c61726176656c2d6c6f63616c697a6174696f6e2f76657273696f6e2e706e67)](https://packagist.org/packages/fowitech/laravel-localization) [![Total Downloads](https://camo.githubusercontent.com/ee85b8558a2e0f4221743a7533acf9c297c8abdf00c92c9e8062f33d17f1ea02/68747470733a2f2f706f7365722e707567782e6f72672f666f7769746563682f6c61726176656c2d6c6f63616c697a6174696f6e2f642f746f74616c2e706e67)](https://packagist.org/packages/fowitech/laravel-localization) [![Build Status](https://camo.githubusercontent.com/a6914f1489be11e48b5f6aef043b50f821e5bd768a6ccddb56802d0838ca1061/68747470733a2f2f7472617669732d63692e6f72672f666f7769746563682f6c61726176656c2d6c6f63616c697a6174696f6e2e706e67)](https://travis-ci.org/fowitech/laravel-localization)[![Open Source Helpers](https://camo.githubusercontent.com/f065a26457985bf6ff6750133cf4062b7e326b0bfe430fe89a4d8e60d4154ba3/68747470733a2f2f7777772e636f64657472696167652e636f6d2f666f7769746563682f6c61726176656c2d6c6f63616c697a6174696f6e2f6261646765732f75736572732e737667)](https://www.codetriage.com/fowitech/laravel-localization)[![Reviewed by Hound](https://camo.githubusercontent.com/5d8f6d94715fbd69d4f1c74b9825421774847089f891b382cd4acb4bb63a0a25/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f52657669657765645f62792d486f756e642d3845363442302e737667)](https://houndci.com)

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)

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

[](#table-of-contents)

- [Installation](#installation)
- [Usage](#usage)
- [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 fowitech/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="Fowitech\Localization\LocalizationServiceProvider"

```

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

The configuration options are:

- **supportedLocales** Languages of your app (Default: English &amp; Spanish).
- **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:

```
