PHPackages                             vojtasvoboda/oc-cnbrates-plugin - 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. vojtasvoboda/oc-cnbrates-plugin

ActiveOctober-plugin[Utility &amp; Helpers](/categories/utility)

vojtasvoboda/oc-cnbrates-plugin
===============================

ČNB rates plugin for OctoberCMS

1.0.3(10y ago)1151[1 issues](https://github.com/vojtasvoboda/oc-cnbrates-plugin/issues)MITPHPPHP &gt;=5.5.9

Since Mar 30Pushed 9y ago1 watchersCompare

[ Source](https://github.com/vojtasvoboda/oc-cnbrates-plugin)[ Packagist](https://packagist.org/packages/vojtasvoboda/oc-cnbrates-plugin)[ Docs](https://github.com/vojtasvoboda/oc-cnbrates-plugin)[ RSS](/packages/vojtasvoboda-oc-cnbrates-plugin/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (3)Used By (0)

ČNB Rates plugin for OctoberCMS
===============================

[](#čnb-rates-plugin-for-octobercms)

[![Build Status](https://camo.githubusercontent.com/ce2ff9b495e926e9d741c80024d775b9dc9914e89daf1c58e056df82bca7f62b/68747470733a2f2f7472617669732d63692e6f72672f766f6a746173766f626f64612f6f632d636e6272617465732d706c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/vojtasvoboda/oc-cnbrates-plugin)[![HHVM Status](https://camo.githubusercontent.com/a0cd171b5da995e62c6b96b6eba16f056d3c9def190d2a9f202a3234323b8bd4/68747470733a2f2f696d672e736869656c64732e696f2f6868766d2f766f6a746173766f626f64612f6f632d636e6272617465732d706c7567696e2f6d61737465722e737667)](http://hhvm.h4cc.de/package/vojtasvoboda/oc-cnbrates-plugin)[![Codacy](https://camo.githubusercontent.com/7aa64d9d9bd7429c3c76a39f3908d1e2f0b88f47913dbacb5491eabdf41f4cff/68747470733a2f2f696d672e736869656c64732e696f2f636f646163792f65383439373332316461656234646264626563326263616138633734323036632e737667)](https://www.codacy.com/app/vojtasvoboda/oc-cnbrates-plugin)[![Scrutinizer Coverage](https://camo.githubusercontent.com/9e48f1c2d995b649a5eb762c0623e0f7fa22ddb762f89af969b6b618fd50ba48/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f766f6a746173766f626f64612f6f632d636e6272617465732d706c7567696e2e737667)](https://scrutinizer-ci.com/g/vojtasvoboda/oc-cnbrates-plugin/?branch=master)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/vojtasvoboda/oc-cnbrates-plugin/blob/master/LICENSE)

ČNB Rates plugin provide financial data from ČNB (Czech National Bank).

Implemented ČNB services: Exchange rates, PRIBOR rates.

Features:

- automatically daily update
- fires event after update, so integration is very easy
- prepared for implementating other ČNB services
- covered by unit tests

Required plugins: none. Tested with the latest stable OctoberCMS build 349.

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

[](#installation)

- install plugin VojtaSvoboda.CnbRates from your Backend -&gt; Settings -&gt; System -&gt; Updates -&gt; Install plugins
- select which services you want to use at Settings -&gt; System -&gt; Misc -&gt; ČNB Rates

Events
------

[](#events)

The best and easiest way how to use this plugin is by events.

This plugin provide two events. When you set *Scheduled updates* correctly (see below), this events will be fired each day automatically and always comes with fresh rates data.

- **vojtasvoboda.cnbrates.exchange.updated** Fired when exchange rates are updated
- **vojtasvoboda.cnbrates.pribor.updated** Fired when PRIBOR rates are updated

Using event in your Plugin.php:

```
public function boot()
{
    // ČNB rates update listener
    Event::listen('vojtasvoboda.cnbrates.exchange.updated', function($rates)
    {
        // update my plugin with fresh data
        $this->updateMyProducts($rates);
    });
}

```

All methods are fired after calling update method e.g. *updateTodayExchangeRates()*manually or by scheduler.

Scheduled updates
-----------------

[](#scheduled-updates)

For scheduled updates to operate correctly, you should add the following Cron entry to your server. Editing the crontab is commonly performed with the command crontab -e.

`* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1`

Be sure to replace /path/to/artisan with the absolute path to the artisan file in the root directory of October.

Thats all, rates will be updated every day and related events will be fired.

Exchange rates service
----------------------

[](#exchange-rates-service)

Data are taken from [official daily exchange rate list](https://www.cnb.cz/cs/financni_trhy/devizovy_trh/kurzy_devizoveho_trhu/denni_kurz.jsp).

### Get all exchange rates

[](#get-all-exchange-rates)

```
$cnb = App::make('cnb');
// rates for today
$rates = $cnb->getExchangeRates();
// for specific date
$rates = $cnb->getExchangeRates('12.1.2016');

```

### Get exchange rate only for EUR currency

[](#get-exchange-rate-only-for-eur-currency)

```
$cnb = App::make('cnb');
// rates for today
$rates = $cnb->getExchangeRate();
// for specific date
$rates = $cnb->getExchangeRate('12.1.2016');

```

### Callable service used for CRON call

[](#callable-service-used-for-cron-call)

Downloads daily exchange rates, saves it to cache and fires `vojtasvoboda.cnbrates.exchange.updated` event. This method is prepared for using by CRON (see Setting CRON section).

```
$cnb = App::make('cnb');
$cnb->updateTodayExchangeRates();

```

PRIBOR rates service
--------------------

[](#pribor-rates-service)

Data are taken from [official daily PRIBOR rate list](https://www.cnb.cz/cs/financni_trhy/penezni_trh/pribor/denni.jsp).

More about [PRIBOR](https://cs.wikipedia.org/wiki/Prague_InterBank_Offered_Rate).

PRIBOR is changed daily and is calculated for these intervals: year, 9 months, 6 months, 3 months, 2 months, month, 2 weeks, week and for one day.

### Get all PRIBOR rates

[](#get-all-pribor-rates)

```
$cnb = App::make('cnb');
// rates for today
$rates = $cnb->getPriborRates();
// for specific date
$rates = $cnb->getPriborRates('12.1.2016');

```

### Get PRIBOR rate only for concrete interval

[](#get-pribor-rate-only-for-concrete-interval)

```
$cnb = App::make('cnb');
// today yearly PRIBOR rate
$rates = $cnb->getPriborRate($date = null, $interval = 'year');
// or shortcuts
$rates = $cnb->getPriborRateForYear('12.1.2016');
$rates = $cnb->getPriborRateFor9Months('12.1.2016');
$rates = $cnb->getPriborRateFor6Months('12.1.2016');
$rates = $cnb->getPriborRateFor3Months('12.1.2016');
$rates = $cnb->getPriborRateFor2Months('12.1.2016');
$rates = $cnb->getPriborRateForMonth('12.1.2016');
$rates = $cnb->getPriborRateFor2Weeks('12.1.2016');
$rates = $cnb->getPriborRateForWeek('12.1.2016');
$rates = $cnb->getPriborRateForDay('12.1.2016');

```

### Callable service used for CRON call

[](#callable-service-used-for-cron-call-1)

Download daily exchange rates, save it to cache and fires `vojtasvoboda.cnbrates.exchange.updated` event. This method is prepared for using by CRON.

```
$cnb = App::make('cnb');
$cnb->updateTodayExchangeRates();

```

Testing
-------

[](#testing)

Run `phpunit` command in plugin directory. All test must pass.

Future plans
------------

[](#future-plans)

**Feel free to send pullrequest!**

- implement other ČNB services
- add button 'Update rates now'

License
-------

[](#license)

ČNB Rates plugin is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT) same as OctoberCMS platform.

Contributing
------------

[](#contributing)

Please send Pull Request to master branch.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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

2

Last Release

3741d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/533ab9a0897c6c6754ac9baf2ad6e42ecbc2a57aa67c72b885fcc647c7ae6930?d=identicon)[VojtaSvoboda](/maintainers/VojtaSvoboda)

---

Top Contributors

[![vojtasvoboda](https://avatars.githubusercontent.com/u/374917?v=4)](https://github.com/vojtasvoboda "vojtasvoboda (40 commits)")

---

Tags

octobercms-pluginpluginexchangeratesoctobercnb

### Embed Badge

![Health badge](/badges/vojtasvoboda-oc-cnbrates-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/vojtasvoboda-oc-cnbrates-plugin/health.svg)](https://phpackages.com/packages/vojtasvoboda-oc-cnbrates-plugin)
```

###  Alternatives

[chowjiawei/laravel-help-plugin

Integrating useful auxiliary functions into laravel,Assistant tools based on laravel.

671.7k](/packages/chowjiawei-laravel-help-plugin)[martin/forms-plugin

Create easy (and almost magic) AJAX forms

601.3k](/packages/martin-forms-plugin)

PHPackages © 2026

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