PHP code example of pixelant / pxa-site-choice-recommendation

1. Go to this page and download the library: Download pixelant/pxa-site-choice-recommendation 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/ */

    

pixelant / pxa-site-choice-recommendation example snippets



  VendorName\YourExtensionName\EventListener\IpDetectorFactoryEvent:
    tags:
      - name: event.listener
        identifier: 'yourExtensionNameIpDetectorFactoryEvent'
        event: Pixelant\PxaSiteChoiceRecommendation\Detector\Event\AddDetectorFactoryEvent
        after: acceptLanguageDetectorFactoryEvent




declare(strict_types=1);

namespace VendorName\YourExtensionName\EventListener;

use Pixelant\PxaSiteChoiceRecommendation\Detector\Event\AddDetectorFactoryEvent;
use Pixelant\PxaSiteChoiceRecommendation\Detector\Factory\IpDetectorFactory;

/**
 * Adds IpDetector to Detectors.
 */
final class IpDetectorFactoryEvent
{
    public function __invoke(AddDetectorFactoryEvent $event)
    {
        // Add IP Detector.
        $event->addDetectorFactoryCreators(IpDetectorFactory::class);
        // Set path to GeoLite2-Country.mmdb.
        $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['pxa_site_choice_recommendation']['countryDbPath']
            = 'EXT:your_extension_name/Resources/Private/GeoIp2/GeoLite2-Country.mmdb';
    }
}