PHPackages                             yasser-elgammal/green-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. yasser-elgammal/green-locale

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

yasser-elgammal/green-locale
============================

Localized model attributes for Green Framework Web &amp; API.

v1.0.0(1mo ago)00MITPHPPHP ^8.2

Since May 31Pushed 1w agoCompare

[ Source](https://github.com/YasserElgammal/green-locale)[ Packagist](https://packagist.org/packages/yasser-elgammal/green-locale)[ RSS](/packages/yasser-elgammal-green-locale/feed)WikiDiscussions main Synced 1w ago

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

Green Locale
============

[](#green-locale)

> This package provides Localization for [Green Framework](https://github.com/YasserElgammal/green).

Localized JSON attributes for Green Framework models.

`green-locale` lets a model store translated attributes such as `name`, `description`, or `slug` in a single JSON column, then read the right value for the current locale with explicit model methods.

Contents
--------

[](#contents)

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Bootstrapping](#bootstrapping)
- [Database columns](#database-columns)
- [Model setup](#model-setup)
- [Reading locale values](#reading-locale-values)
- [Writing locale values](#writing-locale-values)
- [Persisting model changes](#persisting-model-changes)
- [Locale resolution](#locale-resolution)
- [Querying localized values](#querying-localized-values)
- [Validation rules](#validation-rules)
- [Events](#events)
- [Helpers](#helpers)
- [Testing](#testing)
- [Full example](#full-example)
- [Troubleshooting](#troubleshooting)
- [Contributing](#contributing)

Requirements
------------

[](#requirements)

- PHP `^8.2`
- Green Framework skeleton with `yasser-elgammal/green-core`
- Doctrine DBAL, already used by Green
- Respect Validation, used for the package validation rules

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

[](#installation)

Install it normally:

```
composer require yasser-elgammal/green-locale
```

Configuration
-------------

[](#configuration)

Create `config/locale.php` in your Green skeleton:

```
