PHP code example of queue-fair / magentoadapter

1. Go to this page and download the library: Download queue-fair/magentoadapter 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/ */

    

queue-fair / magentoadapter example snippets


    nano vendor/queue-fair/magadapter/QueueFairConfig.php

    nano /path/to/magento/pub/index.php

if(strpos($_SERVER["REQUEST_URI"],"/rest/") === false && strpos($_SERVER["REQUEST_URI"],"/ajax/") === false) { 
    r\QueueFairAdapter(new QueueFair\Adapter\QueueFairConfig());
    
    $queueFair->requestedURL = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https://" : "http://")
        .$_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];
    $queueFair->query = $_SERVER["QUERY_STRING"];
    $queueFair->remoteAddr = $_SERVER["REMOTE_ADDR"];
    $queueFair->userAgent = $_SERVER["HTTP_USER_AGENT"];
    $queueFair->cookies = $_COOKIE;
    
    if(!$queueFair->go()) {
        exit();
    }
    unset($queueFair);
}