PHPackages                             jield-webdev/jield-slm-locale - 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. jield-webdev/jield-slm-locale

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

jield-webdev/jield-slm-locale
=============================

Automatic detection of locales for Laminas

v0.3.0(8y ago)0227BSD-3-ClausePHPPHP ^5.6 || ^7.0

Since May 19Pushed 3y agoCompare

[ Source](https://github.com/jield-webdev/jield-slm-locale)[ Packagist](https://packagist.org/packages/jield-webdev/jield-slm-locale)[ Docs](https://github.com/juriansluiman/SlmLocale)[ RSS](/packages/jield-webdev-jield-slm-locale/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (13)Versions (13)Used By (0)

SlmLocale
=========

[](#slmlocale)

[![Build Status](https://camo.githubusercontent.com/40edefe342dd2f8e21540c8d84210198c31a48f1a7c676ed44470eda88d7dd38/68747470733a2f2f7472617669732d63692e6f72672f6261737a2f536c6d4c6f63616c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/basz/SlmLocale)[![Latest Stable Version](https://camo.githubusercontent.com/4c50ad6f1c500434c6f7a56f5c8c58e07ad43f4ae445a0d6ea0234e089a8db66/68747470733a2f2f706f7365722e707567782e6f72672f736c6d2f6c6f63616c652f762f737461626c652e706e67)](https://packagist.org/packages/slm/locale)[![Coverage Status](https://camo.githubusercontent.com/729d1586bef09c23752c63a8b490b4c691570700944dd3dc9f3c8d2d9817073d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6261737a2f536c6d4c6f63616c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/basz/SlmLocale?branch=master)

Created by Jurian Sluiman

Introduction
------------

[](#introduction)

SlmLocale is a Laminas module to automatically detect a locale for your application. It uses a variety of pluggable strategies to search for a valid locale. SlmLocale features a default locale, a set of supported locales and locale aliases.

SlmLocale supports out of the box several strategies to search for a locale. Through interfaces, other strategies could be created. The set of default stragies is:

1. The HTTP `Accept-Language` header
2. A cookie to store the locale between several sessions of one visitor
3. A query parameter to easily switch from locale
4. The first segment of the path of an uri
5. A part of the domain name (either the TLD or a subdomain)

Furthermore, it provides a set of additional localisation features:

1. A default locale, used as fallback
2. A set of aliases, so you can map `.com` as "en-US" in the host name strategy
3. Redirect to the right domain/path when a locale is found
4. View helpers to create a localised uri or a list of language switches

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

[](#installation)

Add "slm/locale" to your composer.json file and update your dependencies. Enable SlmLocale in your `application.config.php`.

If you do not have a composer.json file in the root of your project, copy the contents below and put that into a file called `composer.json` and save it in the root of your project:

```
{
    "require": {
        "slm/locale": ">=0.1.0,">

```

### Disable UriPathStrategy in PHPUNIT

[](#disable-uripathstrategy-in-phpunit)

This is necessary (at the moment) if you want to use `this->dispatch('my/uri');` in your `AbstractHttpControllerTestCase` unit tests. Otherwise, if you check for responseCode you will get `302` where it should be `200`.

Example:

```
$this->dispatch('/to/my/uri');
$this->assertResponseStatusCode(200); // this will be 302 instead of 200

$this->dispatch('/en/to/my/uri');
$this->assertResponseStatusCode(200); // this will be 302 instead of 200

```

To fix add the following to your phpunit config.

phpunit.xml:

```

    ...

```

Or set `$_SERVER['DISABLE_URIPATHSTRATEGY'] = true;` in your bootstrap file of phpunit.

### Create a list of available locales

[](#create-a-list-of-available-locales)

T.B.D

Read more about usage and the configuration of all the strategies in the [documentation](docs/1.Introduction.md).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~205 days

Recently: every ~353 days

Total

9

Last Release

3093d ago

PHP version history (3 changes)v0.0.1PHP &gt;=5.3.3.

v0.2.0PHP ^5.5 || ^7.0

v0.3.0PHP ^5.6 || ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e015020fd0b3c5bb51b7d9c09205fa556a424a8d5345030a77fbafcbf05385c?d=identicon)[japaveh](/maintainers/japaveh)

---

Top Contributors

[![svycka](https://avatars.githubusercontent.com/u/1270782?v=4)](https://github.com/svycka "svycka (43 commits)")[![basz](https://avatars.githubusercontent.com/u/143068?v=4)](https://github.com/basz "basz (38 commits)")[![kokspflanze](https://avatars.githubusercontent.com/u/1885435?v=4)](https://github.com/kokspflanze "kokspflanze (28 commits)")[![japaveh](https://avatars.githubusercontent.com/u/1028237?v=4)](https://github.com/japaveh "japaveh (8 commits)")[![fwwarr](https://avatars.githubusercontent.com/u/485106?v=4)](https://github.com/fwwarr "fwwarr (3 commits)")[![RWOverdijk](https://avatars.githubusercontent.com/u/781745?v=4)](https://github.com/RWOverdijk "RWOverdijk (3 commits)")[![swiftchase](https://avatars.githubusercontent.com/u/8070208?v=4)](https://github.com/swiftchase "swiftchase (2 commits)")[![jroedel](https://avatars.githubusercontent.com/u/3315281?v=4)](https://github.com/jroedel "jroedel (2 commits)")[![prolic](https://avatars.githubusercontent.com/u/394428?v=4)](https://github.com/prolic "prolic (2 commits)")[![slavcodev](https://avatars.githubusercontent.com/u/757721?v=4)](https://github.com/slavcodev "slavcodev (1 commits)")[![sasezaki](https://avatars.githubusercontent.com/u/42755?v=4)](https://github.com/sasezaki "sasezaki (1 commits)")[![atukai](https://avatars.githubusercontent.com/u/308995?v=4)](https://github.com/atukai "atukai (1 commits)")

---

Tags

i18nzflocaleZend Framework

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jield-webdev-jield-slm-locale/health.svg)

```
[![Health](https://phpackages.com/badges/jield-webdev-jield-slm-locale/health.svg)](https://phpackages.com/packages/jield-webdev-jield-slm-locale)
```

###  Alternatives

[slm/locale

Automatic detection of locales for Laminas

68264.6k4](/packages/slm-locale)[fightbulc/moment

Parse, validate, manipulate, and display dates in PHP w/ i18n support. Inspired by moment.js

9693.2M10](/packages/fightbulc-moment)[codemix/yii2-localeurls

Automatic locale/language management for URLs.

4071.3M30](/packages/codemix-yii2-localeurls)[aplus/language

Aplus Framework Language Library

2351.7M15](/packages/aplus-language)[vluzrmos/language-detector

Detect the language for your application using browser preferences, subdomains or route prefixes.

109554.8k3](/packages/vluzrmos-language-detector)[tractorcow/silverstripe-fluent

Simple localisation for Silverstripe

92421.6k26](/packages/tractorcow-silverstripe-fluent)

PHPackages © 2026

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