PHPackages                             syonix/http-header-accept-language - 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. syonix/http-header-accept-language

ActiveLibrary

syonix/http-header-accept-language
==================================

A parser for the Accept-Language HTTP header following RFC 2616

v1.0.2(5y ago)0515MITPHP

Since Sep 28Pushed 5y ago2 watchersCompare

[ Source](https://github.com/Syonix/http-header-accept-language)[ Packagist](https://packagist.org/packages/syonix/http-header-accept-language)[ RSS](/packages/syonix-http-header-accept-language/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Accept-Language HTTP Header Parser
==================================

[](#accept-language-http-header-parser)

A parser for the Accept-Language HTTP header following [RFC 2616](https://tools.ietf.org/html/rfc2616#section-14.4)

[![Build Status](https://camo.githubusercontent.com/5fdf3b19ad2fdcbd8a1cc546ccbc8af7a4d0ff9373404097e9436e91c953c532/68747470733a2f2f7472617669732d63692e6f72672f53796f6e69782f687474702d6865616465722d6163636570742d6c616e67756167652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Syonix/http-header-accept-language)

Usage
-----

[](#usage)

```
use Syonix\Http\Header\AcceptLanguage\AcceptLanguage;

$parsed = AcceptLanguage::parse('da, en-gb;q=0.8, en;q=0.7'); // Returns Array ordered by quality (q)
$parsed = AcceptLanguage::match('de-CH, de-DE;q=0.9, de;q=0.8', ['de-DE', 'de']); // Returns 'de-DE'
```

Notes
-----

[](#notes)

- `AcceptLanguage::match()` throws a RuntimeException, if none of the accepted languages matches and `*` is not in the `Accept-Languages` string.
- If `*` is accepted and none of the other accepted languages match, the passed `$default` parameter is passed
- If `$default` is omitted, the first element of the `$locale` array is returned.
- Both `parse` and `match` are case insensitive.
- `parse` always returns the case of the input string
- `match` always returns the case of the provided locale array.
- As per the RFC, the quality value defaults to `q=1`.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

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

Every ~17 days

Total

3

Last Release

2019d ago

### Community

Maintainers

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

---

Top Contributors

[![mpbzh](https://avatars.githubusercontent.com/u/6039062?v=4)](https://github.com/mpbzh "mpbzh (6 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/syonix-http-header-accept-language/health.svg)

```
[![Health](https://phpackages.com/badges/syonix-http-header-accept-language/health.svg)](https://phpackages.com/packages/syonix-http-header-accept-language)
```

PHPackages © 2026

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