PHPackages                             cognetif/site-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. [Localization &amp; i18n](/categories/localization)
4. /
5. cognetif/site-language

AbandonedLibrary[Localization &amp; i18n](/categories/localization)

cognetif/site-language
======================

Description

v0.1.3(6y ago)0174[1 PRs](https://github.com/cognetif/site-language/pulls)MITPHPPHP ^7.2CI failing

Since Sep 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/cognetif/site-language)[ Packagist](https://packagist.org/packages/cognetif/site-language)[ RSS](/packages/cognetif-site-language/feed)WikiDiscussions master Synced 2d ago

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

Cognetif Site Language
======================

[](#cognetif-site-language)

[![Build Status](https://camo.githubusercontent.com/4fda58918bab2b7e51f3637983d485b3af96c7d78a1dc388cb46b9cb6f7a3bb3/68747470733a2f2f7472617669732d63692e6f72672f636f676e657469662f736974652d6c616e67756167652e7376673f6272616e63683d6d6173746572)](https://camo.githubusercontent.com/4fda58918bab2b7e51f3637983d485b3af96c7d78a1dc388cb46b9cb6f7a3bb3/68747470733a2f2f7472617669732d63692e6f72672f636f676e657469662f736974652d6c616e67756167652e7376673f6272616e63683d6d6173746572) [![MIT LICENSE](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](/LICENSE)

This library will attempt to detect a best match between the browsers accepted language from `$_SERVER['HTTP_ACCEPT_LANGUAGE']` and the provided array of website accepted languages. If no match can be found the default fallback will be returned. If the server accept languages includes a locale like `fr-FR`, the `fr` will be used to match.

Installation
------------

[](#installation)

Install with composer:

```
$ composer install cognetif/site-language
```

How to Use
----------

[](#how-to-use)

```
use Cognetif\SiteLanguage\SiteLanguage;

$siteLanguage = new SiteLanguage();
$siteLanguage->setDefault('fr');
$siteLanguage->setAccepted(['en','fr']);

$languageToUse = $siteLanguage->get();
```

Run Tests
---------

[](#run-tests)

```
$ ./vendor/bin/phpunit
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Licence
-------

[](#licence)

MIT - See: [LICENCE](LICENSE)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance54

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

2433d ago

### Community

Maintainers

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

---

Top Contributors

[![cognetif](https://avatars.githubusercontent.com/u/47219867?v=4)](https://github.com/cognetif "cognetif (15 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cognetif-site-language/health.svg)

```
[![Health](https://phpackages.com/badges/cognetif-site-language/health.svg)](https://phpackages.com/packages/cognetif-site-language)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

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