Download the PHP package niels-numbers/laravel-localizer without Composer
On this page you can find all versions of the php package niels-numbers/laravel-localizer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download niels-numbers/laravel-localizer
More information about niels-numbers/laravel-localizer
Files in niels-numbers/laravel-localizer
Package laravel-localizer
Short Description Detects the user’s preferred language and redirects to the matching localized URL.
License MIT
Informations about the package laravel-localizer
Laravel Localizer
Successor to
mcamara/laravel-localization. Static routes,route:cacheready.
Locale-aware routing for Laravel: auto-detect, auto-redirect, and resolve route() per language.
Documentation: localizer.adam-nielsen.de
Example
Produces:
/about- this endpoint carries the package's core magic: auto-detection, redirect, or default locale (see below)/de/about,/fr/about, ... for every other configured locale
Every route is registered twice as a static route:
In your application code, keep using route('about'); the package
picks the right variant based on the current locale.
How /about resolves at request time:
- First visit: the package reads the
Accept-Languageheader (or your own detector chain) and redirects to the matching localized URL. - Subsequent visits: an explicit URL prefix always wins.
Without a URL signal, the locale is taken from the session and
cookie. The user is redirected to the prefixed variant unless
their locale matches the default and
hide_default_localeis on - in which case they are redirected or stay on/about. - Fallback: when no signal matches, the configured default locale is used.
Note: a switcher link to plain
/aboutcarries no locale signal -RedirectLocalewould send the user back to their session locale instead of switching. See Language Switcher for more.
Install
Setup guide · Migrating from mcamara/laravel-localization?
License & credits
MIT licensed. Created by Adam Nielsen, building on prior work by
@mcamara (original
laravel-localization),
@codezero-be (deprecated
laravel-localized-routes, whose static-route ideas inspired this
rewrite) and
@jordyvanderhaegen (current
maintainer of the original, whose
issue #921
motivated this package).
All versions of laravel-localizer with dependencies
codezero/browser-locale Version ^3.0
illuminate/support Version ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0