PHPackages                             unnutz/php-lcid - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. unnutz/php-lcid

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

unnutz/php-lcid
===============

1.0.0(11y ago)09PHPPHP &gt;=5.4.0

Since Feb 21Pushed 11y ago1 watchersCompare

[ Source](https://github.com/unnutz/php-lcid)[ Packagist](https://packagist.org/packages/unnutz/php-lcid)[ RSS](/packages/unnutz-php-lcid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

PHP-LCID
========

[](#php-lcid)

[![Travis-CI](https://camo.githubusercontent.com/da705b6a085b4d3b705928195516adf310164795d85a35fce422e05501d94b92/68747470733a2f2f7472617669732d63692e6f72672f756e6e75747a2f7068702d6c6369642e737667)](https://camo.githubusercontent.com/da705b6a085b4d3b705928195516adf310164795d85a35fce422e05501d94b92/68747470733a2f2f7472617669732d63692e6f72672f756e6e75747a2f7068702d6c6369642e737667) [![Latest Stable Version](https://camo.githubusercontent.com/9e3ecbc226b06d4ba2c47ca0305becdd9ee8897809ceaf80a49d321066b9e2e9/68747470733a2f2f706f7365722e707567782e6f72672f756e6e75747a2f7068702d6c6369642f76657273696f6e2e737667)](https://packagist.org/packages/unnutz/php-lcid) [![Total Downloads](https://camo.githubusercontent.com/3892dcbfc3e7f857936154b17b6012c50efde2414c0ba30bc71b8506bcb7668b/68747470733a2f2f706f7365722e707567782e6f72672f756e6e75747a2f7068702d6c6369642f646f776e6c6f6164732e737667)](https://packagist.org/packages/unnutz/php-lcid)

This is a simple library that allows you to build correct LCID (Language Code Identifier) based on language, region, script values or locale.

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

[](#installation)

Add `"unnutz/php-lcid": "~1"` to your composer.json

Run `composer update`

### Laravel 4.2

[](#laravel-42)

Add `Unnutz\PhpLcid\PhpLcidServiceProvider::class` to your application's configuration file under providers section

In case you want to use built-in facade then add `'Lcid' => 'Unnutz\PhpLcid\Facades\LcidLaravel'` to your application's configuration file under aliases section

Run `artisan dump-autoload`

Usage
-----

[](#usage)

### Laravel 4.2

[](#laravel-42-1)

#### Facade

[](#facade)

Get LCID based on language, region, script, variant and sort combination

```
Lcid::get($language, $region = null, $script = null, $variant = null, $sort = \Unnutz\PhpLcid\Enums\Sort::SORT_DEFAULT);
```

Get LCID based on locale and sort combination

```
Lcid::getByLocale($locale, $sort = \Unnutz\PhpLcid\Enums\Sort::SORT_DEFAULT);
```

Get locale based on LCID

```
Lcid::findLocale($lcid, $returnArray = false)
```

#### IoC

[](#ioc)

In class constructor assign type hint like:

```
function __construct(LcidInterface $lcid)
{
    $this->lcid = $lcid;
}
```

All methods listed previously are available for you from now on.

### Standalone

[](#standalone)

You can use either facade `Unnutz\PhpLcid\Facades\LcidFacade` or class instance

```
$lcid = new \Unnutz\PhpLcid\Lcid;
```

All methods listed previously are available for you.

License
-------

[](#license)

The MIT License (MIT)

Copyright (c) 2015 Artyom Sokolov

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

4104d ago

### Community

Maintainers

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/unnutz-php-lcid/health.svg)

```
[![Health](https://phpackages.com/badges/unnutz-php-lcid/health.svg)](https://phpackages.com/packages/unnutz-php-lcid)
```

###  Alternatives

[rafaelfragoso/haversini-formula

This PHP class can replace the Google Distance Matrix to calculate the distance between two points using latitude and longitude. It will prevent you to do massive requests to Google servers and enhance your service performance.

45212.0k](/packages/rafaelfragoso-haversini-formula)

PHPackages © 2026

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