1. Go to this page and download the library: Download heureka-agency/switcheroo 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/ */
heureka-agency / switcheroo example snippets
return [
/**
* Add any currencies you would like to handle with Switcheroo.
* You can select all currencies using \HeurekaAgency\Switcheroo\Enums\Currency::all()
*/
'enabled_currencies' => [
\HeurekaAgency\Switcheroo\Enums\Currency::EUR,
\HeurekaAgency\Switcheroo\Enums\Currency::USD,
\HeurekaAgency\Switcheroo\Enums\Currency::GBP,
],
/**
* Set the default currency of the currency switcher.
*/
'default_currency' => \HeurekaAgency\Switcheroo\Enums\Currency::EUR
];
#[On('currency-selected')]
public function yourCurrencySwitchHandler(string $currency): void
{
$currency = Currency::from($currency);
// any other business logic
}