PHPackages                             kuenzelit/auto-lang - 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. kuenzelit/auto-lang

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

kuenzelit/auto-lang
===================

A package to automatically detect and set the locale in a laravel application

118PHP

Since Feb 2Pushed 11y ago1 watchersCompare

[ Source](https://github.com/KuenzelIT/auto-lang)[ Packagist](https://packagist.org/packages/kuenzelit/auto-lang)[ RSS](/packages/kuenzelit-auto-lang/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

AutoLang
========

[](#autolang)

AutoLang is a small package for Laravel applications which automatically detects the users browser language and sets this language with the `App::setLocale()` command.

It uses `Session` to temporarily save the language, so it doesn't need to detect the language on every request. Furthermore you can tell AutoLang which language to use, e.g. if a user wants to switch to another language than the browser has set.

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

[](#installation)

#### Get the package

[](#get-the-package)

Use the command line to get AutoLang:

```
composer require kuenzelit/auto-lang:dev-master

```

**OR** put this line in your composer.json file:

```
"kuenzelit/auto-lang": "dev-master",

```

#### Service Provider

[](#service-provider)

Add the service provider to your list of providers in `app.php`:

```
"Kuenzelit/AutoLang/AutoLangServiceProvider",

```

#### Alias

[](#alias)

If you like, you can register an alias by putting this line in your `aliases` array

```
'AutoLang' => 'Kuenzelit\AutoLang\Facades\AutoLang',

```

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

[](#configuration)

You may use artisan to publish the configuration file and edit it to specify the languages you're offering:

```
php artisan config:publish kuenzelit/auto-lang

```

Interface
---------

[](#interface)

The `AutoLang`-Facade provides 4 methods: `set`, `get`, `availableLanguages` and `detectLanguage`:

```
/**
 * Overrides the currently detected language and sets it to the $lang param.
 * $lang has to be from the array of available languages.
 *
 * @param $lang
 * @throws \Exception
 */
public function set($lang)

/**
 * Returns the current language.
 * @return mixed
 */
public function get()

/**
 * Returns the array of available languages. Can be set in the packages config.php.
 *
 * @return array
 */
public function availableLanguages()

/**
 * Returns the language of the users browser.
 *
 * @return string
 */
public function detectLanguage()
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/0762fac70a58ee29e487f8451f44d4b10c1841b263f91c866e3079fd53381a1b?d=identicon)[KuenzelIT](/maintainers/KuenzelIT)

### Embed Badge

![Health badge](/badges/kuenzelit-auto-lang/health.svg)

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

###  Alternatives

[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)[inpsyde/multilingual-press

Simply THE multisite-based free open source plugin for your multilingual websites.

2414.0k1](/packages/inpsyde-multilingual-press)[statikbe/laravel-chained-translator

The Laravel Chained Translator can combine several translators that can override each others translations.

36149.4k6](/packages/statikbe-laravel-chained-translator)

PHPackages © 2026

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