2017 © Pedro PelĆ”ez
 

library bank

PHP script works with currencies

image

pupitooo/bank

PHP script works with currencies

  • Thursday, March 27, 2014
  • by pupitooo
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Pupitooo/Bank

Bank is PHP script works with currencies. This extension is for Nette framework 2+., (*1)

Requirements

Pupitooo\Bank requires PHP 5.3.2 or higher., (*2)

Installation

The best way to install Pupitooo/Bank is using Composer:, (*3)

$ composer require pupitooo/bank:@dev

Example NEON config

services:
    - Pto\Bank\Storages\Storage
    - Nette\Http\SessionSection(@session, 'bank')
    bank:
            class: Pto\Bank\Bank
            setup: 
                    - loadCurrency('EUR', NULL, {mask: '1 S', thousand: ' ', point: ',', zeroClear: FALSE, decimal: 2, symbol: € })
                    - loadCurrency('CZK', NULL, {mask: '1 S', thousand: ' ', point: ',', zeroClear: FALSE, decimal: 2, symbol: Kč})
                    - loadCurrency('USD')

Example Nette 2.1 use

In Presenter, (*4)

    /** @var \Pto\Bank\Bank @inject */
    public $bank;

    protected function startup()
    {
        parent::startup();

        $bank = $this->bank;

        $bank->setDownload(\Pto\Bank\Bank::DOWNLOAD_METHOD_CNB);

        $bank->loadCurrency("CZK")
                ->setRate(27.8);
        $bank->loadCurrency("USD", NULL)
                ->setProfil(array('mask' => 'S 1', 'thousand' => ',', 'point' => '.', 'zeroClear' => FALSE, 'decimal' => 2, 'symbol' => '$'));
        $bank->loadCurrency("GBP", NULL, array('mask' => 'S 1', 'thousand' => ',', 'point' => '.', 'zeroClear' => FALSE, 'decimal' => 2, 'symbol' => 'Ā£'));
    }

    public function actionDefault()
    {
        $bank = $this->bank;

        Nette\Diagnostics\Debugger::barDump($bank->change(1, "EUR", "CZK"));
        Nette\Diagnostics\Debugger::barDump($bank->change(1, "EUR", "GBP"));
        Nette\Diagnostics\Debugger::barDump($bank->change(1, "EUR", "HUF"));

        Nette\Diagnostics\Debugger::barDump($bank->format(1, "EUR"));
        Nette\Diagnostics\Debugger::barDump($bank->format(1, "EUR", "CZK"));
        Nette\Diagnostics\Debugger::barDump($bank->format(1, "EUR", "USD"));
        Nette\Diagnostics\Debugger::barDump($bank->format(1, "EUR", "GBP"));
        
        \Nette\Diagnostics\Debugger::barDump($bank->getDefault());
        \Nette\Diagnostics\Debugger::barDump($bank->getActualRate("EUR"));
        \Nette\Diagnostics\Debugger::barDump($bank->getActualRate("CZK"));
        \Nette\Diagnostics\Debugger::barDump($bank->getActualRate("GBP"));
        \Nette\Diagnostics\Debugger::barDump($bank->getActualRate("USD"));
        \Nette\Diagnostics\Debugger::barDump($bank->getActualRate("HUF"));
    }

In Latte, (*5)

    {1|currency} = {1|currencyTo:"EUR"}
    {1|currency} = {1|currencyTo:"CZK"}
    {1|currency} = {1|currencyTo:"USD"}
    {1|currency} = {1|currencyTo:"GBP"}

    {1|currency:"CZK"} = {1|currency:"CZK":"EUR"}
    {1|currency:"USD"} = {1|currency:"USD":"EUR"}
    {1|currency:"GBP"} = {1|currency:"GBP":"USD"}

Repository http://github.com/pupitooo/bank., (*6)

The Versions

27/03 2014

dev-master

9999999-dev https://github.com/pupitooo/bank

PHP script works with currencies

  Sources   Download

MIT

The Requires

 

by Petr Poupě

27/03 2014

v1.0.1

1.0.1.0 https://github.com/pupitooo/bank

PHP script works with currencies

  Sources   Download

MIT

The Requires

 

by Petr Poupě

27/03 2014

v1.0.0

1.0.0.0 https://github.com/pupitooo/bank

PHP script works with currencies

  Sources   Download

MIT

The Requires

 

by Petr Poupě