PHP code example of mooore / magento2-module-geoip
1. Go to this page and download the library: Download mooore/magento2-module-geoip 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/ */
mooore / magento2-module-geoip example snippets
php
namespace Acme\Component;
use Mooore\GeoIp\Api\CountryCodeInterface;
class SomeComponent
{
/**
* @var \Mooore\GeoIp\Api\CountryCodeInterface
*/
private $countryCode;
public function __construct(CountryCodeInterface $countryCode)
{
$this->countryCode = $countryCode;
}
public function execute(): void
{
//output: Country is NL
echo sprintf('Country is %s', $this->countryCode->get());
}
}