PHPackages                             prunacatalin/filament-locale-switcher - 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. prunacatalin/filament-locale-switcher

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

prunacatalin/filament-locale-switcher
=====================================

Drop-in topbar locale switcher for Filament v4/v5 panels. Session + per-user persistence, explicit locale list, render-hook dropdown.

v1.0.0(2mo ago)2675MITPHPPHP ^8.2

Since May 24Pushed 2mo agoCompare

[ Source](https://github.com/PrunaCatalin/filament-locale-switcher)[ Packagist](https://packagist.org/packages/prunacatalin/filament-locale-switcher)[ RSS](/packages/prunacatalin-filament-locale-switcher/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Filament Locale Switcher
========================

[](#filament-locale-switcher)

Drop-in locale switcher for Filament v4/v5 panels. Topbar dropdown (or user-menu items), session / per-user / cookie persistence, explicit locale whitelist, six-step resolution chain.

Install
-------

[](#install)

```
composer require prunacatalin/filament-locale-switcher
```

Publish the config (optional — the plugin works without it, but config is the recommended source of truth):

```
php artisan vendor:publish --tag=filament-locale-switcher-config
```

If you intend to persist the user's choice on their account, run the migration to add a `locale` column to `users`:

```
php artisan migrate
```

Configure
---------

[](#configure)

`config/filament-locale-switcher.php`:

```
return [
    'locales'     => ['en', 'ro', 'fr', 'it'],
    'labels'      => [
        'en' => 'English',
        'ro' => 'Română',
        'fr' => 'Français',
        'it' => 'Italiano',
    ],
    'flags'       => [
        'en' => '🇬🇧',
        'ro' => '🇷🇴',
        'fr' => '🇫🇷',
        'it' => '🇮🇹',
    ],
    'persist'        => 'user',     // session | user | cookie
    'user_column'    => 'locale',   // column on User when persist=user
    'placement'      => 'topbar',   // topbar | user-menu | both
    'topbar_offset'  => '4.5rem',   // CSS gap between switcher and user-menu
];
```

Wire it into your panel
-----------------------

[](#wire-it-into-your-panel)

Two lines: register the plugin, append the middleware to your panel middleware list (it MUST run after `StartSession`).

```
use Prunacatalin\FilamentLocaleSwitcher\Http\Middleware\ApplyLocale;
use Prunacatalin\FilamentLocaleSwitcher\LocaleSwitchPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        // …your usual config…
        ->plugin(LocaleSwitchPlugin::make())
        ->middleware([
            // …default Filament middleware (EncryptCookies, StartSession, …)…
            ApplyLocale::class,
        ]);
}
```

That's it. The plugin reads from `config/filament-locale-switcher.php`; the dropdown renders in the panel topbar; clicking a flag persists the choice and reloads the current page in that language.

### Per-panel override

[](#per-panel-override)

Every config key has a matching fluent setter. Useful when a single Laravel app hosts two panels with different policies:

```
$panel->plugin(
    LocaleSwitchPlugin::make()
        ->locales(['en', 'de'])      // narrower than the global list
        ->persist('cookie')          // override global persist
        ->placement('user-menu'),    // override global placement
);
```

Setters always win over config.

Resolution chain (per request)
------------------------------

[](#resolution-chain-per-request)

1. `?lang=xx` query parameter
2. session value (last switch in this browser)
3. cookie (when `persist=cookie`)
4. authenticated user's column (when `persist=user`)
5. `Accept-Language` header
6. `config('app.locale')`

Anything outside the configured `locales` whitelist is rejected — tampered session/cookie values can never load an arbitrary lang path.

Testing
-------

[](#testing)

```
composer install
composer test
```

Pest suite uses Orchestra Testbench with SQLite `:memory:`. 21 tests / 39 assertions cover the resolver chain, the plugin's config hydration, the middleware, and every controller persistence branch.

License
-------

[](#license)

MIT.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance88

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

61d ago

### Community

Maintainers

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

---

Tags

i18ntranslationlocalefilamentfilament-plugin

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/prunacatalin-filament-locale-switcher/health.svg)

```
[![Health](https://phpackages.com/badges/prunacatalin-filament-locale-switcher/health.svg)](https://phpackages.com/packages/prunacatalin-filament-locale-switcher)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[illuminate/translation

The Illuminate Translation package.

6938.0M581](/packages/illuminate-translation)[bezhansalleh/filament-language-switch

Zero config Language Switch(Changer/Localizer) plugin for filamentphp admin

3581.3M33](/packages/bezhansalleh-filament-language-switch)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

274333.4k9](/packages/croustibat-filament-jobs-monitor)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)

PHPackages © 2026

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