Skip to content
Laravel Packagev13.xMIT License1.2K+ downloads

Localization: Every language at its own URL

Localization registers your routes once per language as real, cacheable Laravel routes, with translated paths and localized slugs, and negotiates the language of API responses from the user, session, cookie or Accept-Language header, without hidden redirects or shared state.

$composer require pharaonic/laravel-localization

Compatibility

Each line is released for the versions in its row, read from that release's composer.json. Pick the line that matches your project; a combination not listed isn't supported. Find the right line of every package for your project.

LineLatest releasePHPLaravelStatusDocs
v13.xv13.0.0 Nov 19, 20268.3 – 8.513Current Docs: Read the v13.x docs
v12.xv12.0.0 Nov 19, 20268.2 – 8.512Maintained Docs: Read the v12.x docs
v11.xv11.0.0 Nov 19, 20268.2 – 8.411MaintainedLaravel 11 no longer gets security fixes Docs: Read the v11.x docs
v10.xv10.0.0 Nov 19, 20268.1 – 8.310MaintainedLaravel 10 no longer gets security fixes Docs: Read the v10.x docs
v9.xv9.0.0 Nov 19, 20268.0 – 8.29MaintainedLaravel 9 no longer gets security fixes Docs: Read the v9.x docs
v8.xv8.0.0 Nov 19, 20268.0 – 8.18MaintainedLaravel 8 no longer gets security fixes Docs: Read the v8.x docs
v7.xv7.0.0 Nov 19, 20268.07MaintainedLaravel 7 no longer gets security fixes Docs: Read the v7.x docs
v6.xv6.0.0 Nov 19, 20268.06MaintainedLaravel 6 no longer gets security fixes Docs: Read the v6.x docs

Maintenance

Latest release
v13.0.0
Nov 19, 2026 (1 week ago)
Released lines
8
documented lines with a release; see compatibility
CI on develop
Tests passed
latest run Nov 19, 2026

From the package's releases and its GitHub Actions. A passing run means the test suite passed on develop, on every PHP version it supports; it isn't a security review, and each release line has its own runs on GitHub. Checked hourly.

A quick look

Localized pages for the website, negotiated locales for the API.

routes/web.php
1use App\Http\Controllers\ApiProductController;
2use App\Http\Controllers\ProductController;
3 
4Route::localized(function (): void {
5 Route::get('/products', [ProductController::class, 'index'])->name('products.index');
6});
7// /products (en), /ar/المنتجات, /fr/produits
8 
9Route::middleware('localization')
10 ->get('/api/products', [ApiProductController::class, 'index']);
11// Accept-Language: ar-EG,ar;q=0.9 → Content-Language: ar
12 
13locale()->route('products.index', locale: 'fr'); // "https://example.com/fr/produits"
Key Features

Everything a multilingual Laravel app needs

Wrap routes in one macro for websites, add one middleware for APIs.

Static Localized Routes

Route::localized() registers one real route per locale, safe for route:cache.

Translated URLs

Translate path segments with lang/{locale}/routes.php, Unicode included.

Resolver Pipeline

User, session, cookie, Accept-Language or your own class, in your order.

Switcher & hreflang

switchUrl(), alternates() and hreflangs() for the current page.

Native Signed URLs

Sign localized routes with Laravel's own signer and signed middleware.

Predictable

No hidden redirects, no automatic writes, and nothing carried between requests.

Related Guides

Practical guides that use Laravel Localization, or solve the problem it was built for.

FAQ

Localization Questions

Quick answers about installing and using Localization.

What is Localization?

Localized routing for Laravel. Static, cacheable locale-prefixed URLs for websites, and an ordered resolver pipeline (user, session, cookie, Accept-Language) for APIs. It's a free, open-source Laravel package by Pharaonic.

How do I install Localization?

Run composer require pharaonic/laravel-localization in your project's root directory.

What does Localization require?

The latest release requires PHP 8.3 – 8.5 and Laravel 13.

Does it work with route:cache?

Yes. Every locale gets its own static route, and the locale is stored in the route itself, so cached routes behave exactly like uncached ones. Use controller actions, since Laravel can't cache closures.

Can a cookie or the browser change the language of /ar/products?

No. A language in the URL always wins, and the unprefixed URL is always the default language. Preferences only apply to routes that use the localization middleware.

Does it support sub-domains or country domains?

Not as a built-in mode. Use Laravel's Route::domain() groups, and a custom resolver when the domain decides the language.

Is Localization free to use?

Yes. Localization is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the Localization documentation?

Read the Localization documentation for setup, configuration, and usage examples.

How do I report a bug or contribute to Localization?

Open an issue or a pull request on GitHub, ask in GitHub Discussions, or chat with us on Discord.

Ready to dig in?

Read the full documentation for installation, configuration, path routing, translated routes, localized slugs, negotiated locales, custom resolvers, preferences, signed URLs, hreflang, diagnostics and upgrading from 1.x.