PHPackages                             aristonis/laravel-language-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. aristonis/laravel-language-switcher

ActiveLaravel-package[Localization &amp; i18n](/categories/localization)

aristonis/laravel-language-switcher
===================================

auto detected user language and set it for application with manully option for user to slelect language

1.0(7mo ago)04MITPHP

Since Oct 1Pushed 7mo agoCompare

[ Source](https://github.com/aristonis/laravel-language-switcher)[ Packagist](https://packagist.org/packages/aristonis/laravel-language-switcher)[ RSS](/packages/aristonis-laravel-language-switcher/feed)WikiDiscussions main Synced 1mo ago

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

Laravel Language Switcher
=========================

[](#laravel-language-switcher)

[![Total Downloads](https://camo.githubusercontent.com/165c68a599e932dfa678e79df3c803a90630eb515b81f4bec93bdb222ecfd701/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61726973746f6e69732f6c61726176656c2d6c616e67756167652d73776974636865722e737667)](https://packagist.org/packages/aristonis/laravel-language-switcher)

Auto-detects user language from browser/session and sets it for the Laravel application. Provides manual selection via a form component.

Features
--------

[](#features)

- Automatic language detection (browser, session, custom detectors).
- Session-based persistence.
- User profile integration for authenticated users.
- Blade component for language switcher.
- Configurable supported languages and detectors.

Installation
------------

[](#installation)

1. Install via Composer:

    ```
    composer require aristonis/laravel-language-switcher

    ```
2. Publish config file:

    ```
    php artisan vendor:publish --provider="Aristonis\LaravelLanguageSwitcher\LaravelLanguageSwitcherServiceProvider" --tag="config"

    ```
3. Register middleware
4. Add route in `routes/web.php`:

    ```
    Route::post('/language-switch', [\Aristonis\LaravelLanguageSwitcher\Http\Controllers\LanguageSwitchController::class, 'update'])->name('language-switch.update');
    ```

Configuration
-------------

[](#configuration)

In `config/language-switcher.php`:

- `supported_languages`: Array of supported locales (e.g., `['en' => 'English', 'ar' => 'Arabic']`).
- `detectors`: Enabled detectors (e.g., `['browser']`).
- `session_key`: Session key for locale (default: `__lang`).

Usage
-----

[](#usage)

### Middleware

[](#middleware)

Automatically sets `app()->setLocale()` on each request.

### Language Switcher Component

[](#language-switcher-component)

In Blade views:

```

```

### Detectors

[](#detectors)

- Browser: Detects from `Accept-Language` header.
- Custom:
    - Extends: `LanguageDetectorInterface`
    - add new class on config file with array `detectors`

### Manual Update

[](#manual-update)

POST to `/language-switch` with `locale` field.

Publishing Views
----------------

[](#publishing-views)

```
php artisan vendor:publish --provider="Aristonis\LaravelLanguageSwitcher\LaravelLanguageSwitcherServiceProvider" --tag="views"

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Issues
------

[](#issues)

Report issues at [GitHub Issues](https://github.com/aristonis/laravel-language-switcher/issues).

Collaboration
-------------

[](#collaboration)

Contributions welcome! Fork the repo, create a feature branch, and submit a pull request. See [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Email  or report via [Issues](https://github.com/aristonis/laravel-language-switcher/issues).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

Support
-------

[](#support)

For support, open an [issue](https://github.com/aristonis/laravel-language-switcher/issues).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance63

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

228d ago

### Community

Maintainers

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

---

Top Contributors

[![mekadalibrahem](https://avatars.githubusercontent.com/u/79482795?v=4)](https://github.com/mekadalibrahem "mekadalibrahem (11 commits)")

### Embed Badge

![Health badge](/badges/aristonis-laravel-language-switcher/health.svg)

```
[![Health](https://phpackages.com/badges/aristonis-laravel-language-switcher/health.svg)](https://phpackages.com/packages/aristonis-laravel-language-switcher)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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