PHPackages                             sheepy85/l5-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. sheepy85/l5-localization

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

sheepy85/l5-localization
========================

Simple Localization Middleware for Laravel 5

v1.0.4(11y ago)2381MITPHPPHP &gt;=5.4.0

Since Oct 22Pushed 11y ago1 watchersCompare

[ Source](https://github.com/sheepy85/l5-localization)[ Packagist](https://packagist.org/packages/sheepy85/l5-localization)[ RSS](/packages/sheepy85-l5-localization/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (1)Versions (7)Used By (0)

l5-localization
===============

[](#l5-localization)

Simple Localization Middleware for Laravel 5 to make dynamic prefixed route names to the same controller actions.

Features
--------

[](#features)

- Seo friendly url generation: example.com/news, example.com/en/news, example.com/es/noticias, example.com/fr/nouvelles
- Session stored Localization data.
- Locale prefix Route names
- Lang file stored Route url with model name
- Route Cache

Facade Alias : Locale

Setup
-----

[](#setup)

Step 1: Add to stack

```
// App\Http\Kernel.php
protected $stack = [
    ...
    'Sheepy85\L5Localization\Middleware\Localization',
];
```

Step 2: Use routes.php file

```
// App\Providers\RouteServiceProvider.php
public function map( Router $router ) {
    require app_path( 'Http/routes.php' ); // uncomment
}
```

Step 3: Add the ServiceProvider

```
// config/app.php
'providers' => [
    ...
    'Sheepy85\L5Localization\L5LocalizationServiceProvider' ,
] ,
```

Step 4: Use file generator

```
> php artisan locale:select en es fr
```

to get the full list of Localization short codes use -l or --list

Examples
--------

[](#examples)

Example files in project folder.

`Locale::locales()` looking for config/locale.php, set optional parameter to `true` for raw url generation `Locale::router()` return Laravel Router instance and only accept `[get, post, put, delete, patch]` methods

Generate route:cache for all of your languages
----------------------------------------------

[](#generate-routecache-for-all-of-your-languages)

1 arg: If your routes lang file don't contain the route name, use as raw Uri 2 arg: Route name 3 arg: Action 4 arg: Localization short code

```
// routes.php
foreach ( Locale::codes( true ) as $code ) {
// or
//foreach ( Locale::locales( true ) as $code => $locale ) {
   Route::group( [
	   'namespace' => '\App\Http\Controllers' ,
	   'prefix' => $code ,
	   ] , function() use( $code ) {

	  Locale::router()->get( '/' , 'home' , 'HomeController@index' , $code );
	  Locale::router()->get( 'routes.news' , 'news' , 'HomeController@news' , $code );
	  Locale::router()->post( 'login' , 'login' , 'AuthController@login' , $code );
   } );
}
```

Result:

```
GET|HEAD /              | home     | App\Http\Controllers\HomeController@index
GET|HEAD news           | news     | App\Http\Controllers\HomeController@news
POST login              | login    | App\Http\Controllers\AuthController@login
GET|HEAD en             | en.home  | App\Http\Controllers\HomeController@index
GET|HEAD en/news        | en.news  | App\Http\Controllers\HomeController@news
POST en/login           | en.login | App\Http\Controllers\AuthController@login
GET|HEAD hu             | hu.home  | App\Http\Controllers\HomeController@index
GET|HEAD hu/hirek       | hu.news  | App\Http\Controllers\HomeController@news
POST hu/belepes         | hu.login | App\Http\Controllers\AuthController@login
```

make Url
--------

[](#make-url)

with helper to the session current locale:

```
{{ lroute('news') }}
```

or laravel's helper, notice need to comment out the original function in `Illuminate\Foundation\helpers.php` file

```
{{ route('news') }}
```

Api Locale::
------------

[](#api-locale)

- `has()` Determine localization status
- `get()` Get current localization
- `set( $locale )` Set current localization
- `flush()` Unset Session variable
- `exist( $locale )` Determine localization adjustable
- `notExist( $locale )` Determine localization not adjustable
- `fallback()` Set fallback localization
- `locale()` Get current localization
- `name()` Get current localization english name
- `native()` Get current localization native name
- `script()` Get current localization code script
- `direction()` Get current localization read direction
- `locales( $withNull = false )` Get available localizations, optional empty first row
- `codes( $withNull = false )` Get available localization short codes, optional empty first row

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

5

Last Release

4209d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b0f1f8135c9577d759b235daa149c9b426c8b4028f928a43545d3b5bed4a59cd?d=identicon)[sheepy85](/maintainers/sheepy85)

---

Top Contributors

[![sheepy85](https://avatars.githubusercontent.com/u/8833623?v=4)](https://github.com/sheepy85 "sheepy85 (12 commits)")

### Embed Badge

![Health badge](/badges/sheepy85-l5-localization/health.svg)

```
[![Health](https://phpackages.com/badges/sheepy85-l5-localization/health.svg)](https://phpackages.com/packages/sheepy85-l5-localization)
```

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[opgginc/codezero-laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

2770.1k1](/packages/opgginc-codezero-laravel-localized-routes)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)[amendozaaguiar/laraveles-spanish-for-jetstream

Archivos de traducción al español latinoamericano para Laravel con Jetstream (auth, pagination, passwords, validation + todas las cadenas de Jetstream).

1412.1k](/packages/amendozaaguiar-laraveles-spanish-for-jetstream)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
