PHPackages                             andaletech/laravel-browser-info - 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. andaletech/laravel-browser-info

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

andaletech/laravel-browser-info
===============================

A Laravel 5 package that provide an easy way to get useful browser related information (like supported languages, browser name, etc.) from a request.

v3.0(4y ago)23.5kMITPHPPHP &gt;=8.0.0CI failing

Since Mar 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/andaletech/laravel-browser-info)[ Packagist](https://packagist.org/packages/andaletech/laravel-browser-info)[ RSS](/packages/andaletech-laravel-browser-info/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (3)Versions (9)Used By (0)

Browser Info
============

[](#browser-info)

A Laravel 5 package that provide an easy way to get useful browser related information (like supported languages, browser name, etc.) from a request. To elaborate further...

Work in progress...
===================

[](#work-in-progress)

Installation
============

[](#installation)

Composer
--------

[](#composer)

```
composer require andaletech/laravel-browser-info

```

**In config/app.php** add the following line to the **aliases** section:

```
'BrowserInfo' => Andaletech\BrowserInfo\BrowserInfoFacade::class,

```

Basic Usage
===========

[](#basic-usage)

```
$languages = BrowserInfo::getLanguages();
Log::info('Browser info:',
    [
        'agent' => BrowserInfo::getUserAgent(),
        'languages' => $languages()->toArray(),
        'support_en_not_strict' => $languages->supports('en'),
        'support_en_strict' => $languages->supports('en', true),
        'support_fr_not_strict' => $languages->supports('fr'),
        'support_fr_strict' => $languages->supports('fr-FR', true),
    ]
);

```

Will result in:

```
{
    "agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36",
    "languages":[
        {
            "raw_language":"en-US",
            "language":"en",
            "country":"US",
            "variant":"",
            "q":1
        },
        {
            "raw_language":"en",
            "language":"en",
            "country":"",
            "variant":"",
            "q":0.9
        },
        {
            "raw_language":"fr",
            "language":"fr",
            "country":"",
            "variant":"",
            "q":0.8
        }
    ],
    "support_en_not_strict":true,
    "support_en_strict":true,
    "support_fr_not_strict":true,
    "support_fr_strict":false
}
```

Noteworthy Classes
------------------

[](#noteworthy-classes)

### AcceptedLanguage

[](#acceptedlanguage)

Encapsulates a single language that the browser accepts. This class allows you to access:

- **The two char i18n language code (i.e. en, fr, es)**.
- **The two char i18n country code (i.e. US, FR, ES)**
- **The q (the preference weight) of the language.**.

#### Examples

[](#examples)

If a browser sends: `accept-language: "en-US,en;q=0.9,fr;q=0.8"`
 Then

```
$languages = BrowserInfo::getLanguages();
$aLanguage = $languages->first();
Log::info('$aLanguage\'s language:', ['language' => $aLanguage->getLanguage()]); // en
Log::info('$aLanguage\'s country:', ['country' => $aLanguage->getCountry()]); // US
Log::info('$aLanguage\'s q:', ['language' => $aLanguage->getQ()]); // 1
```

### Languages:

[](#languages)

Languages is a collection class that inherits from Laravel's `Illuminate\Support\Collection`. Therefore, it has all the same methods as the Laravel Collection, plus some additional methods. Those methods are as follows.

#### *supports(string $lang, $strict = false)*

[](#supportsstring-lang-strict--false)

This method takes a i18n language code string (i.e. 'en', 'fr-FR', 'es-ES') as parameter to determine if the browser supports that language. By default, this method returns `true` when the browser supports the given language regardless of the country and/or variant segment of the language code. For example, accept-language: `"en-US,en;q=0.9,fr;q=0.8"`

##### Example

[](#example)

If a browser sends: `accept-language: "en-US,en;q=0.9,fr;q=0.8"`
 Then

```
$languages = BrowserInfo::getLanguages();
Log::info('Supports French', ['output' => $languages->supports('fr')]); // true
Log::info('Supports French', ['output' => $languages->supports('fr', true)]); // true
Log::info('Supports French from France strict', ['output' => $languages->supports('fr-FR')]); // false
Log::info('Supports Spanish (any)', ['output' => $languages->supports('es-ES')]); // true
```

Available Facades
-----------------

[](#available-facades)

### BrowserInfo

[](#browserinfo)

The **BrowserInfo** facade allows you to easily access informations related to the browser such as the supported languages. The available methods are the following.

#### BrowserInfo::getLanguages()

[](#browserinfogetlanguages)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity73

Established project with proven stability

 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

Every ~203 days

Recently: every ~286 days

Total

8

Last Release

1564d ago

Major Versions

v1.1.2 → v2.02021-01-01

v2.0 → v3.02022-01-29

PHP version history (2 changes)v1.0.0PHP &gt;=7.0.0

v3.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/108e7a7337c3544cfe321fe1c4fa2956378f0930fdcd4a4e6bb0a3f026c8ae93?d=identicon)[ksidibe](/maintainers/ksidibe)

---

Top Contributors

[![ksidibe](https://avatars.githubusercontent.com/u/3746660?v=4)](https://github.com/ksidibe "ksidibe (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andaletech-laravel-browser-info/health.svg)

```
[![Health](https://phpackages.com/badges/andaletech-laravel-browser-info/health.svg)](https://phpackages.com/packages/andaletech-laravel-browser-info)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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