subdesign / valutabank
valutabank.hu data parser package
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/subdesign/valutabank
Requires
- php: >=5.4.0
- anlutro/curl: 0.6.2
- illuminate/support: 5.0.*
This package is auto-updated.
Last update: 2025-10-20 06:34:29 UTC
README
With this package you can get the actual HUF (Hungarian Forint) value of different currencies.
Installation
Install with the following Composer command
$ composer require subdesign/valutabank:dev-master
Add the following line in the app/config/app.php file into the service provider array
'Subdesign\Valutabank\Provider\ValutabankServiceProvider',
And add the facade to the aliases array
'Valutabank' => 'Subdesign\Valutabank\Facade\Valutabank',
Publish the config file
$ php artisan vendor:publish
Setting up
You can edit the config file app/config/valutabank.php, options are
return [
	'currencies' => ['USD', 'EUR', 'CHF'], // array of currencies or the string "all" if you want all (array/string)
	'returntype' => 'array',               // html OR array OR json (string)
	'show_bank'	 => true, 				   // show the bank name for rate	
	'curl' 		 => true,	               // use CURL (bool) 
	'cache'		 => true,	               // use caching of server data (bool)
	'cache_ttl'	 => 60,	                   // if caching enabled, set minutes for TTL value (integer)
	'icon_path'  => '/assets/images/',     // relative path (from public/) to the icon images (string)
	'icon_name'  => 'icon',                // icon name prefix. it will be "icon-usd", "icon-eur" etc. (string)
	'icon_ext'   => 'jpg'                  // extension of icon image files (string)
];
Usage
If you use it in your controller, use the Facade of the package like
use Subdesign\Valutabank\Facade\Valutabank;
then
$result = Valutabank::get();
or you can add a backslash to the facade
$result = \Valutabank::get();
Dependency
The package uses anlutro/php-curl for optionally replace file_get_contents() in the code, if the latter is disabled in your server for some reason.
Example data
Getting the USD - HUF exchange rate as array
array(2) {
  ["lastUpdate"]=>
  string(19) "2015-04-15 14:40:17"
  ["USD"]=>
  array(3) {
    ["buying_rate"]=>
    array(2) {
      ["value"]=>
      string(6) "273.71"
      ["bank"]=>
      string(8) "KDB Bank"
    }
    ["selling_rate"]=>
    array(2) {
      ["value"]=>
      string(6) "284.31"
      ["bank"]=>
      string(8) "KDB Bank"
    }
    ["icon"]=>
    string(27) "/assets/images/icon-usd.jpg"
  }
}
Notes
The source code is PSR-1 and PSR-2 compilant.
Please show the link of valutabank.hu somewhere in your view code below the rendered data, for credits.
Copyright
© 2015 Barna Szalai
License
Contact
twitter: @devartpro
email: szalai.b@gmail.com
irc: @BarnaSzalai at #laravel.hu/#laravel (freenode)
slackchat: https://laravelbp.slack.com