lopatin96/lara-locale

Installs: 208

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/lopatin96/lara-locale

1.0.11 2025-03-29 19:08 UTC

This package is auto-updated.

Last update: 2025-09-29 20:18:32 UTC


README

Installation

You can install this package via composer:

composer require lopatin96/lara-locale

Add middleware to bootstrap/app.php

->withMiddleware(function (Middleware $middleware) {
    $middleware->appendToGroup('web', [
        SetLocale::class,
    ]);
})

Fix your route

use Lopatin96\LaraLocale\Helpers\LocaleHelper;

Route::get('/{locale?}', static function () {
    return view('welcome');
})
    ->name('home')
    ->whereIn('locale', LocaleHelper::getAvailableLocales());