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. [HTTP &amp; Networking](/categories/http)
4. /
5. syonix/http-header-accept-language

ActiveLibrary[HTTP &amp; Networking](/categories/http)

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 3w 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 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity57

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

2069d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6162034?v=4)[Syonix](/maintainers/syonix)[@Syonix](https://github.com/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)
```

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.8k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M89](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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