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

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

backpack/language-switcher
==========================

Language Switcher for Backpack

2.1.0(6mo ago)1234.6k↓18.1%31MITPHPCI passing

Since Sep 29Pushed 4mo ago4 watchersCompare

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

READMEChangelog (5)Dependencies (3)Versions (6)Used By (1)

Language Switcher
=================

[](#language-switcher)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d30a7bebb37aa170d273b1d669b6b60442677b48d5dfc95b602620e48e2c5dba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261636b7061636b2f6c616e67756167652d73776974636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backpack/language-switcher)[![Total Downloads](https://camo.githubusercontent.com/1c02150f1807ea9b8cbc639942d86bb255dc71348d05773cea36b9ac47137be2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261636b7061636b2f6c616e67756167652d73776974636865722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backpack/language-switcher)[![The Whole Fruit Manifesto](https://camo.githubusercontent.com/9fc65ecdd629dc33c369f73e0bc051740f01647367c131a574577fea2a5678bb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f77726974696e672532307374616e646172642d74686525323077686f6c6525323066727569742d627269676874677265656e)](https://github.com/the-whole-fruit/manifesto)

This package adds a Language Switcher dropdown for projects using [Backpack for Laravel](https://backpackforlaravel.com/).

Preview
-------

[](#preview)

[![](https://private-user-images.githubusercontent.com/1838187/265306871-abdb196f-1d41-4b14-9dc5-2ac7c64cc84d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQzNjM4MjksIm5iZiI6MTc3NDM2MzUyOSwicGF0aCI6Ii8xODM4MTg3LzI2NTMwNjg3MS1hYmRiMTk2Zi0xZDQxLTRiMTQtOWRjNS0yYWM3YzY0Y2M4NGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDMyNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAzMjRUMTQ0NTI5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDgyNmUwYjNkODU2ZGEwYzQ2M2M0MmZmNzllMThhMDliNjQ5ZGIwZTQ1MjEyNjI5MTFiZmM2ZDdlODNjNzg0ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.8YlUFVcA0VqoQhlzY7OnS1KYWs-LRReQw2D1wTdka5E)](https://private-user-images.githubusercontent.com/1838187/265306871-abdb196f-1d41-4b14-9dc5-2ac7c64cc84d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzQzNjM4MjksIm5iZiI6MTc3NDM2MzUyOSwicGF0aCI6Ii8xODM4MTg3LzI2NTMwNjg3MS1hYmRiMTk2Zi0xZDQxLTRiMTQtOWRjNS0yYWM3YzY0Y2M4NGQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDMyNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjAzMjRUMTQ0NTI5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MDgyNmUwYjNkODU2ZGEwYzQ2M2M0MmZmNzllMThhMDliNjQ5ZGIwZTQ1MjEyNjI5MTFiZmM2ZDdlODNjNzg0ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.8YlUFVcA0VqoQhlzY7OnS1KYWs-LRReQw2D1wTdka5E)Demo
----

[](#demo)

Try it right now, in [our online demo](https://demo.backpackforlaravel.com/admin/).

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

[](#installation)

1. In your Laravel project, install this package:

```
composer require backpack/language-switcher

# optional: publish the config file
php artisan vendor:publish --provider="Backpack\LanguageSwitcher\LanguageSwitcherServiceProvider" --tag="config"
```

2. Add the middleware to backpack config `config/backpack/base.php`:

```
'middleware_class' => [
    ...
    \Backpack\LanguageSwitcher\Http\Middleware\LanguageSwitcherMiddleware::class,
],
```

*Optionally, you may add the middleware to the `web`, `api` or other middleware groups where you may want to use the language switcher, in `app/Http/Kernel.php`.*

3. Add the dropdown view to `topbar_right_content.blade.php` or wherever you need it:

```
@include('backpack.language-switcher::language-switcher')
```

4. In order to add the available languages of your app, you'll need to enable them in the backpack crud config file `config/backpack/crud.php`

```
'locales' => [
    'en' => 'English',
    'pt' => 'Portuguese',
    'ro' => 'Romanian',
    ...
```

There you can set the array of `locales` your app uses. Keep in mind the default locale of your app should remain in `config.app.locale` and `config.app.fallback_locale`.

Usage
-----

[](#usage)

### Can I show/hide the main label or flags?

[](#can-i-showhide-the-main-label-or-flags)

**Yes!**
You can do it by sending special arguments to the component:

```
@include('backpack.language-switcher::language-switcher', [
    'flags' => true, // true by default, change it to hide flags
    'main_label' => false, // false by default, it may also be a string, for instance "Language"
])
```

### Can I use this package outside of the backpack/admin scope?

[](#can-i-use-this-package-outside-of-the-backpackadmin-scope)

**Yes!**
If you wish to use the language switcher on other parts of your app, you can do it by adding the middleware in `app/Http/Kernel.php`. You can, for instance, enable this for the whole `web` middleware group, or the `api`.

```
protected $middlewareGroups = [
    'web' => [
        ...
        \Backpack\LanguageSwitcher\Http\Middleware\LanguageSwitcherMiddleware::class,
    ],
```

### Can I customize the endpoint routes ?

[](#can-i-customize-the-endpoint-routes-)

**Yes!**You can do it by publishing the config file `php artisan vendor:publish --provider="Backpack\LanguageSwitcher\LanguageSwitcherServiceProvider" --tag="config"`. There you can totally disable the package route and register your own, or change some behavior related with display urls.

Please take caution to protect the endpoint with throttling or any other security measure if you overwrite the routes. The default package route uses: `'throttle:60,1'`

Notes
-----

[](#notes)

This package uses [`outhebox/blade-flags`](https://github.com/MohmmedAshraf/blade-flags) to get the flags representing languages/locales.

If you find any issue with any with it, like a missing or wrong flag, you can report directly to the maintainer.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Antonio Almeida](https://github.com/promatik)
- [Cristian Tabacitu](https://github.com/tabacitu)
- [All Contributors](../../contributors)

License
-------

[](#license)

This project was released under MIT License, so you can install it on top of any Backpack &amp; Laravel project. Please see the [license file](license.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance72

Regular maintenance activity

Popularity37

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 56.4% 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

Every ~195 days

Total

5

Last Release

181d ago

Major Versions

1.0.1 → 2.0.02024-01-17

### Community

Maintainers

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

![](https://avatars.githubusercontent.com/u/1838187?v=4)[António Almeida](/maintainers/promatik)[@promatik](https://github.com/promatik)

---

Top Contributors

[![promatik](https://avatars.githubusercontent.com/u/1838187?v=4)](https://github.com/promatik "promatik (22 commits)")[![pxpm](https://avatars.githubusercontent.com/u/7188159?v=4)](https://github.com/pxpm "pxpm (15 commits)")[![ggll11ii](https://avatars.githubusercontent.com/u/189929327?v=4)](https://github.com/ggll11ii "ggll11ii (1 commits)")[![tabacitu](https://avatars.githubusercontent.com/u/1032474?v=4)](https://github.com/tabacitu "tabacitu (1 commits)")

---

Tags

laravellanguagelocalebackpackBackpack for LaravelBackpack Addon

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[codezero/laravel-localized-routes

A convenient way to set up, manage and use localized routes in a Laravel app.

543638.1k4](/packages/codezero-laravel-localized-routes)[backpack/translation-manager

Translation Manager for Backpack

5118.9k1](/packages/backpack-translation-manager)[backpack/theme-tabler

UI for Backpack v6 that uses Tabler and Bootstrap v5.

35536.5k](/packages/backpack-theme-tabler)[backpack/activity-log

Activity Log for Backpack

3487.5k1](/packages/backpack-activity-log)[longman/laravel-multilang

Package to integrate multi language (multi locale) functionality in Laravel 5.x

5514.4k1](/packages/longman-laravel-multilang)[awes-io/localization-helper

Package for convenient work with Laravel's localization features

3527.1k4](/packages/awes-io-localization-helper)

PHPackages © 2026

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