PHPackages                             razonyang/yii-translator-middleware - 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. razonyang/yii-translator-middleware

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

razonyang/yii-translator-middleware
===================================

Yii translator middleware

0.1.1(3y ago)28BSD-3-ClausePHPPHP ^8.0

Since Sep 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/razonyang/yii-translator-middleware)[ Packagist](https://packagist.org/packages/razonyang/yii-translator-middleware)[ RSS](/packages/razonyang-yii-translator-middleware/feed)WikiDiscussions main Synced today

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

Yii Translator HTTP Middleware
==============================

[](#yii-translator-http-middleware)

[![Latest Stable Version](https://camo.githubusercontent.com/120f94d0e5e32dc3e139b33457c72fc8dda259726f77c6b777efcb002a2904dd/68747470733a2f2f706f7365722e707567782e6f72672f72617a6f6e79616e672f7969692d7472616e736c61746f722d6d6964646c65776172652f762f737461626c652e706e67)](https://packagist.org/packages/razonyang/yii-translator-middleware)[![Total Downloads](https://camo.githubusercontent.com/4709863bf50f590a9d49922203b0360f02883ef9dbe97b4042138366a7e265bc/68747470733a2f2f706f7365722e707567782e6f72672f72617a6f6e79616e672f7969692d7472616e736c61746f722d6d6964646c65776172652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/razonyang/yii-translator-middleware)[![Build Status](https://github.com/razonyang/yii-translator-middleware/workflows/build/badge.svg)](https://github.com/razonyang/yii-translator-middleware/actions)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/2a20a68bab8966674dcdb32aeec078c9f64e5338c9aa95045eecad8a296f2162/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72617a6f6e79616e672f7969692d7472616e736c61746f722d6d6964646c65776172652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/razonyang/yii-translator-middleware/?branch=main)[![Code Coverage](https://camo.githubusercontent.com/ac9370a7af77874d2a9ca7c81e7be1ef6f86b644ac3a4b00b80f77445ec383d5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72617a6f6e79616e672f7969692d7472616e736c61746f722d6d6964646c65776172652f6261646765732f636f7665726167652e706e673f623d6d61696e)](https://scrutinizer-ci.com/g/razonyang/yii-translator-middleware/?branch=main)

A HTTP middleware for [Yii Translator](https://github.com/razonyang/yii-translator-middleware).

How it works?
-------------

[](#how-it-works)

1. The `TranslatorMiddleware` parse the locale from incoming request and store the translator instance into request.
2. The subsequent middlewares and handlers can retrieves the translator instance by `TranslatorMiddleware::getTranslator` or `TranslatorMiddleware::getTranslatorByAttributes` static methods.

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

[](#installation)

The package could be installed with composer:

```
composer require razonyang/yii-translator-middleware --prefer-dist
```

Configurations
--------------

[](#configurations)

```
