PHPackages                             ryantxr/browser-preferred-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. [Templating &amp; Views](/categories/templating)
4. /
5. ryantxr/browser-preferred-lang

ActiveLibrary[Templating &amp; Views](/categories/templating)

ryantxr/browser-preferred-lang
==============================

Determines preferred language

1.0(7y ago)06MITPHPPHP &gt;=7.1

Since Oct 4Pushed 7y ago1 watchersCompare

[ Source](https://github.com/ryantxr/browser-lang-detector)[ Packagist](https://packagist.org/packages/ryantxr/browser-preferred-lang)[ RSS](/packages/ryantxr-browser-preferred-lang/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (2)Used By (0)

Browser Preferred Lang
======================

[](#browser-preferred-lang)

This class will take $\_SERVER\['HTTP\_ACCEPT\_LANGUAGE'\] and convert it into a list of languages/locales. The returned array is sorted by preference with the highest preference first in the list.

```
use Ryantxr\BrowserPreferredLang\PreferredLang;
$p = new PreferredLang;
$langs = $p->get(['en', 'zh-cn', 'es'], $_SERVER['HTTP_ACCEPT_LANGUAGE']);
print_r($langs);
```

Output

```
(
    [en] => 0.8
    [es] => 0.4
    [zh-cn] => 0.3
)

```

Installing
----------

[](#installing)

`composer require ryantxr/browser-preferred-lang`

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

2775d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/570a13e97922f5c09d9dc6517329a2898a1097bf85e0f88ccea77c8b0d429f4c?d=identicon)[ryantxr](/maintainers/ryantxr)

---

Top Contributors

[![ryantxr](https://avatars.githubusercontent.com/u/12485311?v=4)](https://github.com/ryantxr "ryantxr (8 commits)")

---

Tags

localizationlanguagetemplate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ryantxr-browser-preferred-lang/health.svg)

```
[![Health](https://phpackages.com/badges/ryantxr-browser-preferred-lang/health.svg)](https://phpackages.com/packages/ryantxr-browser-preferred-lang)
```

###  Alternatives

[phpoffice/phpword

PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)

7.5k34.7M186](/packages/phpoffice-phpword)[rize/uri-template

PHP URI Template (RFC 6570) supports both expansion &amp; extraction

420137.3M46](/packages/rize-uri-template)[mopa/bootstrap-sandbox-bundle

Seperate live docs from code

256.8k](/packages/mopa-bootstrap-sandbox-bundle)[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)

PHPackages © 2026

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