PHPackages                             alex-no/field-lingo-gii - 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. alex-no/field-lingo-gii

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

alex-no/field-lingo-gii
=======================

Gii tools for Field-Lingo (Yii2): Extended model generator and Add-Language generator.

v0.1.5(6mo ago)07MITPHPPHP &gt;=8.0

Since Nov 2Pushed 5mo agoCompare

[ Source](https://github.com/alex-no/field-lingo-gii)[ Packagist](https://packagist.org/packages/alex-no/field-lingo-gii)[ RSS](/packages/alex-no-field-lingo-gii/feed)WikiDiscussions main Synced 1mo ago

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

⚙️ Field-Lingo Gii
==================

[](#️-field-lingo-gii)

[![Packagist Version](https://camo.githubusercontent.com/d1d49c3d0538d01ff2f1eae34f1338c0db7ecfa55fc73c0b0aaf4328426526e7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c65782d6e6f2f6669656c642d6c696e676f2d6769692e737667)](https://packagist.org/packages/alex-no/field-lingo-gii)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/b783cd74695e76c9cd14384d088d8ecce78dbe1a13bd201cd68385d5bc79bac4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616c65782d6e6f2f6669656c642d6c696e676f2d676969)](https://www.php.net/)[![Downloads](https://camo.githubusercontent.com/7b6c878b8c85e520938f43d383113c3d9fc22944f68d228547fb2af1bdb2d78c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c65782d6e6f2f6669656c642d6c696e676f2d6769692e737667)](https://packagist.org/packages/alex-no/field-lingo-gii)

> A set of Gii tools for **Field-Lingo** (Yii2):
>
> - **Extended Model Generator** — generates parent + child model classes wired to `AlexNo\FieldLingo\Adapters\Yii2\LingoActiveRecord` / `AlexNo\FieldLingo\Adapters\Yii2\LingoActiveQuery`.
> - **Add Language Generator** — helps produce SQL-scripts to bulk-add language-suffixed fields (e.g. `name_en`, `name_uk`) across tables.

---

🔎 Overview
----------

[](#-overview)

Field-Lingo stores localized columns directly in DB (e.g. `title_en`, `title_uk`, ...). These Gii tools help automate two repetitive tasks:

1. Generate models that extend `AlexNo\FieldLingo\Adapters\Yii2\LingoActiveRecord` and use `AlexNo\FieldLingo\Adapters\Yii2\LingoActiveQuery`.
2. Generate SQL-scripts to add a language (set of `_xx` fields) across many tables.

---

📦 Installation
--------------

[](#-installation)

Add as a development dependency:

```
composer require --dev alex-no/field-lingo-gii
```

> Note: This package depends on alex-no/field-lingo. Ensure your project requires that package as well (composer will attempt to resolve it). Replace `*` with specific version constraints before tagging stable releases.

---

⚙️ Registering generators in Yii2 (example)
-------------------------------------------

[](#️-registering-generators-in-yii2-example)

In your Yii2 config/web.php (or config/main.php) register generators for the Gii module:

```
'modules' => [
    'gii' => [
        'class' => \yii\gii\Module::class,
        'generators' => [
            'field-lingo-extended-model' => [
                'class' => \AlexNo\FieldLingoGii\ExtendedModel\ExtendedModelGenerator::class,
                'templates' => [
                    'extended' => '@vendor/alex-no/field-lingo-gii/src/ExtendedModel/templates/extended',
                ],
                'baseClassOptions' => [
                    'yii\db\ActiveRecord',
                    'AlexNo\FieldLingo\Adapters\Yii2\LingoActiveRecord',
                ],
                'queryBaseClassOptions' => [
                    'yii\db\ActiveQuery',
                    'AlexNo\FieldLingo\Adapters\Yii2\LingoActiveQuery',
                ],
            ],
            'field-lingo-add-language' => [
                'class' => \AlexNo\FieldLingoGii\AddLanguageColumn\AddLanguageColumnGenerator::class,
                'templates' => [
                    'default' => '@vendor/alex-no/field-lingo-gii/src/AddLanguageColumn/templates/default/',
                ],
            ],
        ],
    ],
],
```

After registering with Gii, two new generators will appear:

- **FieldLingo Extended Model**
- **FieldLingo Add Language**

---

✨ Extended Model Generator — what it does
-----------------------------------------

[](#-extended-model-generator--what-it-does)

- Generates models/base/YourModel.php — main (regenerated) logic;
- Generates models/YourModel.php — empty child class for custom logic;
- Optionally generates models/YourModelQuery.php (using LingoActiveQuery when chosen).

---

✨ Add Language Generator — what it does
---------------------------------------

[](#-add-language-generator--what-it-does)

- Accepts a language code (e.g., es) and a list of tables/fields;
- Generates SQL with addColumn for each field and table.

---

📁 Directory Structure
---------------------

[](#-directory-structure)

```
field-lingo-gii/          # repo root
├─ src/
│  ├─ ExtendedModel
│  │  ├─ ExtendedModelGenerator.php
│  │  ├─ Helpers/
│  │  │  └─ ViewRenderer.php
│  │  ├─ templates/
│  │  │  ├─ extended/
│  │  │  │  ├─ model.php
│  │  │  │  ├─ model-child.php
│  │  │  │  └─ query.php
│  │  │  └─ add-language/
│  │  │     ├─ migration.php
│  │  │     └─ preview.php
│  │  └─ views/
│  │     └─ form.php
│  └─ AddLanguageColumn
│     ├─ AddLanguageGenerator.php
│     ├─ SqlCodeFile.php
│     ├─ Helpers/
│     │  └─ ViewRenderer.php
│     └─ views/
│        ├─ default.php
│        ├─ form.php
│        └─ generator.php
├─ examples/
│  └─ yii2-setup.md
├─ tests/
├─ README.md
├─ composer.json
├─ LICENSE
└─ .gitattributes
```

---

📁 Examples
----------

[](#-examples)

examples/yii2-setup.md contains step-by-step instructions for installing and registering generators.

---

🛠 Development &amp; Tests
-------------------------

[](#-development--tests)

```
composer install
vendor/bin/phpunit
```

---

🤝 Contributing
--------------

[](#-contributing)

PRs welcome. Follow PSR-12, add tests for significant logic.

---

📜 License
---------

[](#-license)

MIT — see LICENSE

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance70

Regular maintenance activity

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

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

Total

5

Last Release

181d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9467184a6504a716bb639f68f9a23ef18735335fe3d625ae8839b726ae4c89cb?d=identicon)[alex-no](/maintainers/alex-no)

---

Top Contributors

[![alex-no](https://avatars.githubusercontent.com/u/6074502?v=4)](https://github.com/alex-no "alex-no (19 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alex-no-field-lingo-gii/health.svg)

```
[![Health](https://phpackages.com/badges/alex-no-field-lingo-gii/health.svg)](https://phpackages.com/packages/alex-no-field-lingo-gii)
```

PHPackages © 2026

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