diggindata/yii2-currencylist Extension to provide a translated list of currency names with currency codes for the Yii framework

Logo_Diggin_Data.jpg

Currency List Extension for Yii 2

  1. Installation
  2. Usage

This package is based on umpirsky/currency-list

It contains an extension for the Yii framework to get a translated list of currency names.

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist diggindata/yii2-currencylist "*"

or add

"diggindata/yii2-currencylist": "*"

to the require section of your composer.json.

Then run composer install or composer update.

Usage

The extension looks at the configured Yii application language Yii::$app->language. So if the language is configured to e.g. de, it takes the corresponding translation list from the umpirsky package.

Once the extension is installed, simply use the list in your forms as follows:

use diggindata\currencylist\CurrencyList;    
<?= $form->field($model, 'currencyCode')->dropDownList(CurrencyList::getList()) ?>

Alternatively, you may add the extension as an application component.

Add the following to your config/web.php file:

...
'components' => [
    'currencyList' => [
        'class' => 'diggindata\currencylist\CurrencyList',
    ],

You can the use it like this:

<?= $form->field($model, 'currencyCode')->dropDownList(Yii::$app->currenyList->getList()) ?>
0 0
1 follower
3 downloads
Yii Version: 2.0
License: BSD-3-Clause
Category: Others
Developed by: jwerner
Created on: Feb 7, 2023
Last updated: (not set)
Packagist Profile
Code Repository

Related Extensions