PHPackages                             jakharbek/yii2-langs - 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. jakharbek/yii2-langs

ActiveYii2-extension[Localization &amp; i18n](/categories/localization)

jakharbek/yii2-langs
====================

Langs

3.0(7y ago)16761MITPHP

Since Jan 30Pushed 7y agoCompare

[ Source](https://github.com/jakharbek/yii2-langs)[ Packagist](https://packagist.org/packages/jakharbek/yii2-langs)[ RSS](/packages/jakharbek-yii2-langs/feed)WikiDiscussions master Synced yesterday

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

Langs
=====

[](#langs)

Langs

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist jakharbek/yii2-langs "*"

```

or add

```
"jakharbek/yii2-langs": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

execute the migration here

```
yii migrate --migrationPath=@vendor/jakharbek/yii2-langs/src/migrations

```

in backend part add this code

```
    'on beforeAction' => function () {
        jakharbek\langs\components\Lang::onRequestHandler();
    },

```

Once the extension is installed, simply use it in your code by :

You need to create in your model (table in the database) for translation for the field `[[lang]]` and the field `[[lang_hash]]`then add the behavior to the model `ActiveRecord`

```
jakharbek\langs\components\ModelBehavior

```

example

```

'lang' => [
           'class' => ModelBehavior::className(),
          ],

```

View
----

[](#view)

To use on the page you had a translation you need to lead widget

```
\jakharbek\langs\widgets\LangsWidgets::widget();

```

 this widget has two modes of operation: single and multiple. When you specify the model property to be translated:

```
\jakharbek\langs\widgets\LangsWidgets::widget(['model_db' => $model,'create_url' => '/url/to/create/']);

```

 then it is in solitary if you do not specify `model_db` then it will work in multiple modes

If you need to take into account the current language in the requests, then you can use the behavior

```
\jakharbek\langs\components\QueryBehavior
```

after applying the behavior you can now use it as an example:

```
YourModel::find()->lang()->...
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

2

Last Release

2659d ago

Major Versions

2.0 → 3.02019-01-31

### Community

Maintainers

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

---

Top Contributors

[![jakharbek](https://avatars.githubusercontent.com/u/31648260?v=4)](https://github.com/jakharbek "jakharbek (3 commits)")

---

Tags

yii2extensionlangs

### Embed Badge

![Health badge](/badges/jakharbek-yii2-langs/health.svg)

```
[![Health](https://phpackages.com/badges/jakharbek-yii2-langs/health.svg)](https://phpackages.com/packages/jakharbek-yii2-langs)
```

###  Alternatives

[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[omgdef/yii2-multilingual-behavior

Port of the yii-multilingual-behavior for yii

143174.9k9](/packages/omgdef-yii2-multilingual-behavior)[lav45/yii2-translated-behavior

This extension allows you to quickly and simple enough to add translations for any ActiveRecord models.

3742.2k](/packages/lav45-yii2-translated-behavior)[geertw/yii2-translatable-url-rule

A custom URL rule class for Yii 2 which allows to create translated URL rules

1420.3k](/packages/geertw-yii2-translatable-url-rule)[devgroup/yii2-multilingual

Allows building yii2 apps for multiple languages using regional URL's and domains

152.6k2](/packages/devgroup-yii2-multilingual)

PHPackages © 2026

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