PHP code example of brightcreations / exchange-rates
1. Go to this page and download the library: Download brightcreations/exchange-rates library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brightcreations / exchange-rates example snippets
use BrightCreations\ExchangeRates\Contracts\ExchangeRateServiceInterface;
// get exchange rates of USD with all other currencies as a laravel collection
$exchangeRates = $service->getExchangeRates('USD');
use BrightCreations\ExchangeRates\Contracts\ExchangeRateServiceInterface;
class SomeClass {
private $exchangeRateService;
public function __construct(ExchangeRateServiceInterface $exchangeRateService) {
$this->exchangeRateService = $exchangeRateService;
}
public function someMethod() {
$exchangeRates = $this->exchangeRateService->getExchangeRates('USD');
// Use $exchangeRates...
}
}
use BrightCreations\ExchangeRates\Contracts\ExchangeRateServiceInterface;
$exchangeRateService = resolve(ExchangeRateServiceInterface::class);
$exchangeRates = $exchangeRateService->getExchangeRates('USD');
// Use $exchangeRates...
use BrightCreations\ExchangeRates\Contracts\ExchangeRateServiceInterface;
$exchangeRateService = app()->make(ExchangeRateServiceInterface::class);
$exchangeRates = $exchangeRateService->getExchangeRates('USD');
// Use $exchangeRates...