torann/localization
Torann Localization brings flexible, database-backed localization to Laravel apps. It offers automatic locale detection, localized routes, translation caching, and helpers for managing language files and strings, making multi-language sites easier to build and maintain.
fr.example.com) is the cheapest credible test of "is market X worth funding?" This package reduces the engineering half of that test to days, so the conversation shifts from sprint capacity to content and go-to-market budget — which is the right framing for deciding which markets we open and in what order.hreflang, and per-locale edge caching; they complicate shared sessions, cookie scoping, wildcard TLS, and any existing subdomain-as-tenant convention. A PM should treat evaluating this package as evaluating that trade-off, not as evaluating a Composer dependency.Consider it only when all of the following hold:
^2.0.4, the Laravel 12-compatible line. Older framework versions are a different conversation.Host header. If your target is /fr/ subdirectories, translated route slugs (/fr/a-propos), or Accept-Language negotiation, this is the wrong tool — reach for mcamara/laravel-localization or write the middleware yourself.app/Packages/localization, pin the upstream commit, and add your own tests. BSD-2-Clause permits this; the cost is roughly a day, and it turns a bus-factor-one dependency into an owned component.en. vs. serve default vs. 404), per-locale canonical and hreflang strategy, session cookie scope across subdomains, and precedence against any existing session- or cookie-based language switcher.TrustProxies configuration under control. Locale is derived from a client-supplied header; getting the proxy layer wrong silently breaks locale resolution behind the edge.Look elsewhere — or budget a sprint to build it — when:
Accept-Language negotiation, or per-user locale preferences. None are in scope.lang/ files). The package description in circulation advertises this; the code in this tag is subdomain routing. Verify against the actual middleware before scoping either feature.mcamara/laravel-localization. Both packages have historically shipped a LaravelLocalization alias; running both produces a fatal conflict for no benefit.For executives — the one-paragraph version: We can test a new geographic market for roughly a sprint of engineering instead of a quarter, using a small open-source Laravel component that routes fr.example.com-style subdomains to the right locale. The package is a two-star, single-maintainer dependency, so we will not depend on it — we will vendor roughly 200 lines under our BSD-2-Clause rights and own them. That reduces the ask to: fund one locale pilot with a defined success metric, and treat the go/no-go on the second market as a content and marketing decision rather than an engineering one.
For engineering — the ask and the shape of the work:
torann/localization:^2.0.4, publish the config, read the middleware and service provider before writing any application code. The entire package is auditable in an afternoon; do that audit as task one.bootstrap/app.php after TrustProxies. Validate the resolved locale against the config allowlist before it reaches any redirect, cache key, or URL::defaults() call — an unvalidated locale segment feeding redirect() is the plausible open redirect in this design.URL::defaults(['locale' => app()->getLocale()]) once, or every route() call outside an HTTP request will silently emit the wrong host. This is the single highest-value line of glue.route() calls reachable from queued jobs, scheduled tasks, console commands, and mailables rendered in workers — there is no request host in those contexts, so URLs fall back to APP_URL.php artisan optimize in CI. Dynamic domain parameters plus cached routes plus cached config is the combination that breaks quietly.Host: evil.example.com and asserts a 404, not a redirect.Decisions we need from product before build starts: apex-host behavior, session cookie domain (.example.com shares the session across all locales — confirm that is intended), canonical and hreflang ownership, and whether the subdomain or an existing switcher wins when both try to set locale. The package answers none of these; we should not discover them in production.
What we are explicitly not buying: translation management, translated slugs, language negotiation, and content workflow. Those remain separate roadmap items, gated on whether the pilot works.
How can I help you explore Laravel packages today?