PHPackages                             amrikasir/lang-selector - 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. amrikasir/lang-selector

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

amrikasir/lang-selector
=======================

Livewire-based language selector for Laravel 11

v1.1.0(4mo ago)027MITPHPPHP ^8.2

Since Oct 22Pushed 4mo agoCompare

[ Source](https://github.com/amrikasir/lang-selector)[ Packagist](https://packagist.org/packages/amrikasir/lang-selector)[ RSS](/packages/amrikasir-lang-selector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Laravel Lang Selector
=====================

[](#laravel-lang-selector)

A simple, elegant, and reusable **Livewire 3** language switcher for **Laravel 11**.
This package provides a ready-to-use dropdown component to switch application locales dynamically — complete with middleware, configuration, and publishable views.

---

✨ Features
----------

[](#-features)

- ⚡ Built with **Livewire 3**
- 🌍 Easy multi-language switching (session-based)
- ⚙️ Configurable via `config/lang-selector.php`
- 🎨 Publishable views for full customization
- 🧩 Simple integration with your existing layout

---

📦 Installation
--------------

[](#-installation)

Require the package via Composer:

```
composer require amrikasir/lang-selector
```

---

⚙️ Publish Config &amp; Views
-----------------------------

[](#️-publish-config--views)

You can publish the default configuration and views to customize them:

```
php artisan vendor:publish --tag=lang-selector-config
php artisan vendor:publish --tag=lang-selector-views
```

This will create:

```
config/lang-selector.php
resources/views/vendor/lang-selector/

```

---

🧩 Usage
-------

[](#-usage)

1. **Register Middleware**

In `app/Http/Kernel.php`, add the middleware to your web group:

```
protected $middlewareGroups = [
    'web' => [
        // ...
        \Kaldiaris\LangSelector\Http\Middleware\LocaleMiddleware::class,
    ],
];
```

2. **Add Component to Blade**

Just drop the component anywhere in your layout:

```

```

That’s it! 🎉
The dropdown will automatically display all available locales from your config.

---

⚙️ Configuration
----------------

[](#️-configuration)

`config/lang-selector.php`

```
return [
    'available_locales' => [
        'en' => 'English',
        'id' => 'Bahasa Indonesia',
        // add more as needed
    ],
    'default_locale' => 'en',
];
```

---

🧠 How It Works
--------------

[](#-how-it-works)

- The `LocaleMiddleware` sets `App::setLocale()` based on the session.
- The `LanguageSelector` Livewire component updates session locale dynamically.
- The selected locale persists until changed again.

---

🧰 Example Styling
-----------------

[](#-example-styling)

You can freely modify the published views at:

```
resources/views/vendor/lang-selector/livewire/language-selector.blade.php

```

Example minimal Tailwind version:

```

        {{ $locales[$current] ?? strtoupper($current) }}

    @if ($open ?? false)

            @foreach ($locales as $key => $label)

                    {{ $label }}

            @endforeach

    @endif

```

---

🧾 License
---------

[](#-license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance77

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

127d ago

### Community

Maintainers

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

---

Top Contributors

[![amrikasir](https://avatars.githubusercontent.com/u/23391439?v=4)](https://github.com/amrikasir "amrikasir (13 commits)")

### Embed Badge

![Health badge](/badges/amrikasir-lang-selector/health.svg)

```
[![Health](https://phpackages.com/badges/amrikasir-lang-selector/health.svg)](https://phpackages.com/packages/amrikasir-lang-selector)
```

###  Alternatives

[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[kerigard/laravel-lang-ru

Ru lang for Laravel

2116.8k](/packages/kerigard-laravel-lang-ru)[highsolutions/laravel-translation-manager

Manage Laravel Translations

1518.8k](/packages/highsolutions-laravel-translation-manager)[amendozaaguiar/laraveles-spanish-for-jetstream

Archivos de traducción al español latinoamericano para Laravel con Jetstream (auth, pagination, passwords, validation + todas las cadenas de Jetstream).

1412.1k](/packages/amendozaaguiar-laraveles-spanish-for-jetstream)

PHPackages © 2026

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