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 5mo 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 2w 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

30

—

LowBetter than 62% of packages

Maintenance50

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

2480d 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

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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