PHPackages                             unicate/language-detection - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. unicate/language-detection

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

unicate/language-detection
==========================

Chainable language detection.

v1.2(5y ago)0231[1 PRs](https://github.com/unicate/language-detection/pulls)1MITPHPPHP ^7.2CI passing

Since May 26Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/unicate/language-detection)[ Packagist](https://packagist.org/packages/unicate/language-detection)[ RSS](/packages/unicate-language-detection/feed)WikiDiscussions master Synced 1mo ago

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

Language Detection
==================

[](#language-detection)

The following different strategies are used to detect the language.

- by Accept-Language-Header (e.g. 'de-CH,en;q=0.8,en-US;q=0.5,fr;q=0.3')
- by Cookie (e.g Cookie 'lang', value 'en')
- by UriPath (e.g. /shop/en/article/3453452)
- by QueryParam (e.g. index.php?lang=en)

These methods can be chained independently after each other. The last method that detects an available language wins. If no language can be detected, the default language will be returned.

### Installation

[](#installation)

Use composer:

```
composer require unicate/language-detection

```

### Usage

[](#usage)

```
