h4kuna / exchange-nette
Exchange between currencies.
Fund package maintenance!
h4kuna
revolut.me/milan2m/czk1000/exchange-nette
Installs: 1 684
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: >=8.0
- h4kuna/dir: ^0.1.3
- h4kuna/exchange: ^v7.1.3
- h4kuna/number-format: ^6.0.4
- latte/latte: ^3.0
- nette/di: ^3.1
- nette/http: ^3.0
- nette/utils: ^3.2 || ^4.0
Requires (Dev)
- guzzlehttp/guzzle: ^7.5
- guzzlehttp/psr7: ^2.0
- malkusch/lock: ^2.2
- nette/application: ^3.1.2
- nette/caching: ^3.2
- nette/tester: ^2.5
- phpstan/phpstan: ^1.9
- phpstan/phpstan-deprecation-rules: ^1.1.3
- phpstan/phpstan-strict-rules: ^1.4
- tracy/tracy: ^2.9
README
This library is extension for Nette Framework and for this Exchange.
Installation
Simple via composer
composer require h4kuna/exchange-nette
optional dependencies
composer require h4kuna/exchange-nette guzzlehttp/guzzle malkusch/lock nette/application nette/caching
Registration
First step is registration extension and set tempDir.
extensions: exchangeExtension: h4kuna\Exchange\DI\ExchangeExtension
Extension is ready to use other configuration are optionally. Default is defined three currencies CZK, EUR and USD. Currencies has default format by h4kuna/number-format, where is documentation.
Configuration
Format options for currency read h4kuna/number-format
exchangeExtension: currencies: czk: # upper / lower code of currency is not important decimals: 3 decimalPoint: '.' thousandsSeparator: ',' zeroIsEmpty: true emptyValue: '-' zeroClear: true mask: '1U' showUnitIfEmpty: false nbsp: true unit: Kč round: h4kuna\Format\Number\Round::BY_CEIL usd: unit: '$' gbp: [] # use default format foo: null # disable driver: # string class of h4kuna\Exchange\Driver\Driver default is Cnb\Day session: false # save info about currencies to session, default is only to cookie vat: 21 # add number like percent strict: true # default enabled, download only defined currencies, example: ['CZK', 'EUR'] defaultFormat: null # how format currency if format is not defined, value is array like above "currencies.czk" managerParameter: 'currency' # is parameter for query, cookie and session if is available tempDir: %tempDir% # temporary directory for cache filters: # extension define frour filter for latte, you can rename currency: currency currencyTo: currencyTo vat: vat vatTo: vatTo
Latte
Now we have four new filters.
{=100|currency} {=100|vat} {=100|currencyTo} {=100|vatTo}
Request
Create url with parameter currency and change value and check cookie.
/?currency=USD