PHPackages                             microinginer/yii2-cbrf-rates - 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. microinginer/yii2-cbrf-rates

ActiveYii2-extensions

microinginer/yii2-cbrf-rates
============================

1.0.0(9y ago)1018.9k—0%4[1 issues](https://github.com/microinginer/yii2-cbrf-rates/issues)[1 PRs](https://github.com/microinginer/yii2-cbrf-rates/pulls)MITPHP

Since Jan 23Pushed 7mo ago2 watchersCompare

[ Source](https://github.com/microinginer/yii2-cbrf-rates)[ Packagist](https://packagist.org/packages/microinginer/yii2-cbrf-rates)[ Docs](https://github.com/microinginer/yii2-cbrf-rates)[ RSS](/packages/microinginer-yii2-cbrf-rates/feed)WikiDiscussions master Synced today

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

yii2-cbrf-rates
===============

[](#yii2-cbrf-rates)

Экстеншен yii2 для получения курса валют в рублях. Источник данных [Центробанк Российской Федерации](http://cbr.ru)

Установка
=========

[](#установка)

Предпочтительный способ установки [composer](http://getcomposer.org/download/).

Запустите комманду

```
php composer.phar require --prefer-dist microinginer/yii2-cbrf-rates "dev-master"

```

или добавьте

```
"microinginer/yii2-cbrf-rates": "dev-master"
```

в раздел `require` в вашем composer.json файле.

В конфигурационном файле добавляем:

```
$config = [
    ...
    'components' => [
        ...
        'CbRF' => [
            'class' => 'microinginer\CbRFRates\CBRF',
            'defaultCurrency' => "EUR"
        ],
        ...
    ]
    ...
]
```

Примеры работы
==============

[](#примеры-работы)

```
// ------------------------------------------------------------------------------------------------------------------------
// Вызов метода all() без вызова других методов возврошает все курсы на текущее время
print_r(Yii::$app->CbRF->all());
/*
Результат работы

Array
(
    ...
    [USD] => Array
        (
            [name] => Доллар США
            [value] => 59.7665
            [char_code] => USD
            [num_code] => 840
            [nominal] => 1
            [id] => R01235
        )
    ...
)
*/
// ------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------
// Вызов метода one() без вызова других методов возврошает курс по умолчаню, указанный в конфиге
print_r(Yii::$app->CbRF->one());

/*
//Результат работы
Array
(
    [name] => Евро
    [value] => 65.9882
    [char_code] => EUR
    [num_code] => 978
    [nominal] => 1
    [id] => R01239
)
*/
// ------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------
// Возвращает все курсы валют для указанной даты
print_r(Yii::$app->CbRF->filter(['date' => time()-(86400*7)]))->all();
// ------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------
// Возвращает курс валюты по умолчанию для указанной даты
print_r(Yii::$app->CbRF->filter(['date' => time()-(86400*7)]))->one();
// ------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------
// Возврощает все курсы валют указанный в параметре currency
print_r(Yii::$app->CbRF->filter(['currency' => 'usd, aud, eur']))->all();
// ------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------

//Вызов метода short()
print_r(Yii::$app->CbRF->short()->all());
/*
Резлуьтат запроса
Array
(
    ...
    [HUF] => 0.21349
    [DKK] => 8.8581
    [USD] => 59.7665
    [EUR] => 65.9882
    [INR] => 0.93502
    [KZT] => 0.318891
    [CAD] => 46.1304
    ...
)
*/
// ------------------------------------------------------------------------------------------------------------------------

// ------------------------------------------------------------------------------------------------------------------------
// Пример получения динамики котировок
print_r(
    Yii::$app
        ->CbRF
        ->filter(['currency' => 'usd, aud, eur']))
        ->withDynamic(['date_from' => '20.05.2015', 'date_to' => '25.05.2015'])
        ->all()
);
/*
//Резлуьтат запроса
Array
(
    ...
    [USD] => Array
        (
            [name] => Доллар США
            [value] => 59.7665
            [char_code] => USD
            [num_code] => 840
            [nominal] => 1
            [id] => R01235
            [dynamic] => Array
                (
                    [0] => Array
                        (
                            [date] => 1432080000
                            [value] => 49.1777
                        )

                    [1] => Array
                        (
                            [date] => 1432166400
                            [value] => 49.7919
                        )

                    [2] => Array
                        (
                            [date] => 1432252800
                            [value] => 49.9204
                        )

                    [3] => Array
                        (
                            [date] => 1432339200
                            [value] => 49.7901
                        )

                )

        )
    ...
)
*/
// ------------------------------------------------------------------------------------------------------------------------
```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance42

Moderate activity, may be stable

Popularity32

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 76.5% 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

Unknown

Total

1

Last Release

3345d ago

### Community

Maintainers

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

---

Top Contributors

[![microinginer](https://avatars.githubusercontent.com/u/1836062?v=4)](https://github.com/microinginer "microinginer (13 commits)")[![uldisn](https://avatars.githubusercontent.com/u/3525344?v=4)](https://github.com/uldisn "uldisn (4 commits)")

---

Tags

yii2ratescbrfкурсывалюты

### Embed Badge

![Health badge](/badges/microinginer-yii2-cbrf-rates/health.svg)

```
[![Health](https://phpackages.com/badges/microinginer-yii2-cbrf-rates/health.svg)](https://phpackages.com/packages/microinginer-yii2-cbrf-rates)
```

###  Alternatives

[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1356.4k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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